アンドロイド 2.3.3
で約5RadioButton
秒ありRadioGroup
ます。使用可能なスペースのほとんどを占めるため、向きを垂直にしたくありません。向きを水平に保つと、2つまたは3つだけが表示され、画面のサイズがすべて水平に収まらないため、残りは消えます。
水平レイアウトで、これらのラジオ ボタンを 1 行以上にまたがることはできますか。
アンドロイド 2.3.3
で約5RadioButton
秒ありRadioGroup
ます。使用可能なスペースのほとんどを占めるため、向きを垂直にしたくありません。向きを水平に保つと、2つまたは3つだけが表示され、画面のサイズがすべて水平に収まらないため、残りは消えます。
水平レイアウトで、これらのラジオ ボタンを 1 行以上にまたがることはできますか。
でラップすることRadioGroup
でこれを実現できます。ユーザーが右にスクロールするHorizontalScrollView
と、次のラジオ ボタンが表示されます。
簡単な方法は、このライブラリを使用することです:
https://github.com/linfaxin/MultiRowsRadioGroup
XML を次のように定義します。
<com.linfaxin.multirowsradiogroup.MultiRowsRadioGroup
android:id="@+id/radioGroup1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@android:id/title"
android:text="radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<RadioButton
android:text="text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RadioButton
android:text="text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<RadioButton
android:text="text4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</com.linfaxin.multirowsradiogroup.MultiRowsRadioGroup>