-1

相対レイアウト内でラジオボタンを使用しています。これが私のコードです

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" >

<FrameLayout android:id="@+id/frameLayout"  android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:layout_alignParentTop="true"
    android:layout_above="@+id/radioButtonGroupLayout">
<!-- Put fragments dynamically -->

</FrameLayout>


<RadioGroup android:id ="@+id/radioButtonGroupLayout" android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" android:layout_alignParentBottom="true">

    <RadioButton android:id="@+id/RadioButton1" 
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:button="@drawable/ip4_menu_but_1_selector" android:background="@drawable/ip4_menu_background_short72"/>
    <RadioButton android:id="@+id/RadioButton2" 
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:button="@drawable/ip4_menu_but_2_selector" android:background="@drawable/ip4_menu_background_short72"/>
    <RadioButton android:id="@+id/RadioButton3" 
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:button="@drawable/ip4_menu_but_3_selector" android:background="@drawable/ip4_menu_background_short72"/>
    <RadioButton android:id="@+id/RadioButton4" 
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:button="@drawable/ip4_menu_but_4_selector" android:background="@drawable/ip4_menu_background_short72"/>
    <RadioButton android:id="@+id/RadioButton5" 
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:button="@drawable/ip4_menu_but_5_selector" android:background="@drawable/ip4_menu_background_short72"/>
</RadioGroup>
</RelativeLayout>

最後のラジオボタンは画面に表示されません。最初の4つのラジオボタンと最後のラジオボタンだけが表示されます。私のコードの何が問題になっていますか?

4

2 に答える 2

0

ラジオボタンにwrap_contentを使用しているため、ボタンと背景に使用しているドローアブルと同じ大きさで表示されている可能性があります。これらの高さと幅を固定dpに変更することをお勧めします。これにより、画面の拡大/縮小に適したスケールになります。

質問を閉じることができるように、このコメントを回答として追加しました。

于 2012-01-06T10:33:13.567 に答える
0

各ラジオボタンでandroid:layout_weight="1"を使用します。画面に任意のサイズの5つのボタンがすべて表示されます。

 <RadioButton
        android:id="@+id/RadioButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

すべてのラジオボタンで同じことをしてください。

于 2013-10-21T09:58:51.643 に答える