3 のみを含む単純な相対レイアウトTextView
を作成しました。コードは以下のとおりです。
<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>
2 番目TextView
(id="age") を右に配置したいので を使用しますlayout_alignParentRight="true"
が、常に 1 番目TextView
(id="name") の後に表示されるのはなぜですか? 親の右(一番右)に行かないのはなぜですか?