2017-02-20 11 views
0
<RelativeLayout 
     android:id="@+id/re1" 
     android:layout_width="match_parent" 
     android:layout_height="85dp" 
     android:layout_below="@+id/view" 
     android:layout_centerHorizontal="true"> 

     <RadioGroup 
      android:id="@+id/radioSex" 
      android:layout_width="match_parent" 
      android:layout_height="455dp" > 

      <RadioButton 
       android:layout_marginTop="10dp" 
       android:id="@+id/alphaa" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Alphabetical(A-Z)" 
       android:checked="true" /> 

      <RadioButton 
       android:layout_marginTop="10dp" 
       android:id="@+id/alphaz" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Alphabetical(Z-A)" /> 
      <RadioButton 
       android:layout_marginTop="10dp" 
       android:id="@+id/distance" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Distance" /> 

     </RadioGroup> 


    </RelativeLayout> 

Радиокнопка последней не видна при запуске кода. Три переключателя в xml.when код запуска последний только не видно. Две кнопки отлично работают. Любая идея.Три переключателя на андрие, но последний из них не виден в студии андроида

В коде xml отображается три кнопки, когда я запускаю код, который он не показывает.

+1

изменение высоты родительского макета для андроида: layout_height = "wrap_content" – lal

+0

предоставить скриншот этой проблемы. –

+0

, если ваш переключатель находится по вертикали, посмотрите на высоту относительной компоновки, которая может оказаться недостаточной для отображения третьей радиообъекта –

ответ

1

Вы можете сделать следующее: Пожалуйста, проверьте.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/re1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@+id/view" 
    android:layout_centerHorizontal="true"> 

    <RadioGroup 
     android:id="@+id/radioSex" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <RadioButton 
      android:id="@+id/alphaa" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:checked="true" 
      android:text="Alphabetical(A-Z)" /> 

     <RadioButton 
      android:id="@+id/alphaz" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:text="Alphabetical(Z-A)" /> 

     <RadioButton 
      android:id="@+id/diswtance" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:text="Distance" /> 

    </RadioGroup> 


</RelativeLayout> 

Измените высоту основного макета макета ... Вы не должны использовать исправление dp для высоты в корневом макете. Вы можете использовать wrap_content или match_parent.

0

Изменить RelativeLayout Высота макета.

wrap_content

Настройка размера ТОЧКА ЗРЕНИЯ к wrap_content заставит его расширить лишь настолько, чтобы содержать значение (или дочерние элементы), которые он содержит.

<RelativeLayout 
     android:id="@+id/re1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 


Your Radio group 

</RelativeLayout> 
0

набор андроида: layout_height = "wrap_content"

<RelativeLayout 
    android:id="@+id/re1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/view" 
    android:layout_centerHorizontal="true"> 
     <RadioGroup 
     android:id="@+id/radioSex" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 


     . 
     . 
     . 
     </RadioGroup> 
    </RelativeLayout>