水平と垂直の中央に 2 つのラジオ ボタンがある RadioGroup を作成しようとしています。しかし、テキストの長さが異なるため、無線で整列したままにしておきたいです。私はこのコードを使用しましたが、相互に排他的ではありません:
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|center_vertical">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rbtn_gps_to"
android:text="to"
android:checked="true"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rbtn_gps_from"
android:text="from"
android:layout_below="@+id/rbtn_gps_to"
/>
</RelativeLayout>
</RadioGroup>
両方とも希望どおりに配置されていますが、問題は、一方をチェックしてからもう一方をチェックすると、最初のものもチェックされたままになるため、排他的ではありません。相対レイアウトを削除すると、ラジオボタンは排他的になります。私が望むレイアウトを作成する方法はありますか?ラジオボタンは排他的なままですか?