<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="@drawable/wallpaper" />
</RelativeLayout>
Size of "@drawable/peetscoffee_wallpaper" is 640x480 , but it is not centered horisontally. How to fix it?
From stackoverflow
-
Try
android:gravity="center"
, orandroid:layout_gravity="center"
, instead ofcenterHorizontal="true"
.However, i doubt this will behave sensibly with an image that size set to
wrap_content
- you may want to define some image scaling method withandroid:scaleType
(egfitCenter
) and set it tofill_parent
rather thanwrap_content
. 640x480 is bigger than the 320x480 the current real-world Android devices support. Or just scale down that image you're using so the device doesn't have to do the work.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.