I am using the following RelativeLayout to create a custom action bar. The problem is that height_indicator
is not showing to the right of animals_view_title
. Instead, they appear superimposed: both at the center. Now on the Graphical Layout it looks correct. But when I run it on my S4 it fails.
<RelativeLayout
android:id="@+id/my_rel_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/CustomTheme"
android:visibility="visible" >
<TextView
android:id="@+id/animals_view_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:text="The Animals"
android:textColor="#DDDDDDDD"
android:textSize="26sp" />
<TextView
android:id="@+id/height_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/animals_view_title"
android:drawableRight="@drawable/height_unit"
android:text="0"
android:textColor="#FFFFFF"
android:textSize="10sp" />
<ImageView
android:id="@+id/edit_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_marginTop="15dp"
android:clickable="true"
android:onClick="editHeight"
android:src="@drawable/edit_button" />
</RelativeLayout>
Remove,
android:layout_centerInParent="true"
fromanimals_view_title
and addandroid:layout_centerVertical="true"
to it.