Simple relative layout compatible with parental law does not work

I made a simple relative layout that contains only 3 TextView , the code 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 placed to the right, so I use layout_alignParentRight="true" , however it always displays after the 1st TextView (id = "name"), Why? Why doesn't he go to parental right (right)?

+4
source share
1 answer

delete this:

 android:layout_toRightOf="@id/name" 

from the age of TextView

+9
source

All Articles