2016-06-15 2 views
1

내 XML에 문제가 있습니다.RadioGroup 보이지 않는 공

내 XML이 textview 근처에 표시되지 않습니다.

내 코드를 보여줍니다.

감사합니다!

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <RadioGroup 
     android:id="@+id/chk_box_tavolo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true"/> 

     <TextView 
      android:id="@+id/name_tavolo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textStyle="bold" /> 
<!--</LinearLayout>--> 
</LinearLayout> 

답변

0

당신을 radioGroup를 사용하는 경우 다음 아이가 대신 텍스트 뷰 사용의 RadioButton의의 RadioButton이어야합니다. , this

각 라디오 버튼 옵션을 만들려면 확인하여 레이아웃에서의 RadioButton을 만듭니다. 그러나 라디오 버튼은 상호 배타적이기 때문에 은 RadioGroup 내에서 함께 그룹화해야합니다. 을 그룹화하면 시스템에서 한 번에 하나의 라디오 버튼을 으로 선택할 수 있습니다.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RadioGroup 
     android:id="@+id/chk_box_tavolo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true"/> 

    <RadioButton 
     android:id="@+id/radioMale" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="male" 
     android:checked="true" /> 

</LinearLayout>