RelativeLayout
ボタンがあり、テキストの下にあります。ボタンのテキストに従ってテキストを揃えたい、つまり、ボタンのテキストのように左から同じ幅で開始するようにします。
使用してみandroid:layout_alignLeft="@id/myButton"
ましたが、ボタンのテキストではなく、ボタンの端に揃えられます。
これを達成する方法はありますか?
私のレイアウト XML では、ボタンとテキストは次のようになります。
<Button
android:id="@+id/myButton"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:text="Some text" />
<TextView
android:id="@+id/myTextView"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignLeft="@id/myButton"
android:layout_below="@id/myButton"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:text="Some text"
android:textAppearance="?android:attr/textAppearanceMedium" />