I have made a simple relative layout which only contains 3 TextView
, code is below:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<!--Why this "age" TextView is not align to parent right?-->
<TextView
android:id="@+id/age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/name"
android:layout_alignParentRight="true"/>
<TextView
android:id="@+id/gender"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"/>
</RelativeLayout>
I would like the 2nd TextView
(id="age") to be positioned to right, so I use layout_alignParentRight="true"
, however, it always show after the 1st TextView
(id="name"), why? Why it does not go to the parent right (rightmost) ?
remove this:
android:layout_toRightOf="@id/name"
from the age TextView
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With