Мои радио кнопки выходят за пределы экрана - PullRequest
0 голосов
/ 06 января 2012

Я использую радиокнопки внутри относительной раскладки, вот мой код

<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 радио-кнопки и и много последних.Что не так в моем коде?

Ответы [ 2 ]

0 голосов
/ 21 октября 2013

использовать android: layout_weight = "1" с каждым переключателем.На экране появятся все 5 кнопок любого размера.

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

, пожалуйста, сделайте то же самое со всеми переключателями.

0 голосов
/ 06 января 2012

Это возможно, так как вы используете wrap_content для переключателей, которые отображают столько же, сколько рисунки, которые вы используете для кнопки и фона.Я бы порекомендовал изменить эти значения высоты и ширины на фиксированный dp, чтобы он лучше масштабировался для экранов большего или меньшего размера.

Добавил этот комментарий как ответ, чтобы вопрос можно было закрыть.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...