I have a simple list item layout to show image and 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 gravity of the text, which should be "center-vertical". When I show the boundaries of the view in the developer’s settings, I see that the size is TextViewlarger than the text itself, but gravity remains on top. The problem appears on my Android device KitKat, but not on Android Froyo, for example.
Happo source
share