filling whole screen with background image!
hii! i am trying to fill an image onto my screen, but it is just covering around 75-80% part of whole screen, not whole screen .the codeblock i am using is as:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FILL_PARENT,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
and main.xml code snippt:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/homepage_image"
android:gravity="center"
><ImageButton
android:id="@+id/btnSequence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_sequence"
android:gravity="center_vertical"/>
<ImageButton
android:id="@+id/btnVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_video"
android:gravity="center_vertical"
/>
<ImageButton
android:id="@+id/btnInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_info"
android:grav开发者_StackOverflow中文版ity="center_vertical"
/>
</LinearLayout>
thanks
If image is less than device screen size android will default to that android:gravity="center" command that you gave it..is the image centered on screen? If so than that might be what is occurring..in which case you need to edit image to screen size of the device.
On my xml I do this to fill the hole screen with an image view:
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
**android:scaleType="fitXY"**
android:src="@drawable/*drawablename*" />
Of course be careful about the size and resolution of you image.
精彩评论