I have a simple list item layout to show a image and a title.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/image" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/image"
android:layout_alignBottom="@+id/image"
android:layout_toRightOf="@+id/image"
android:gravity="center_vertical"
android:text="Title" />
</RelativeLayout>
My problem is the text gravity which should be "center-vertical"
. When I display the view bounds in the developer setting then I can see the TextView
size is greater then the text itself but the gravity stays on top. The problem appears on my android KitKat
device but not on Android Froyo
for example.