2012-03-30 3 views
2

Я пытаюсь сделать групповую деятельность с помощью радиовизора. Моя проблема в том, что я не могу удалить значок динамика, который поставляется с радиокнопкой, любая помощь будет большой благодарностью.Пользовательская группа радио

http://img715.imageshack.us/img715/3131/helpnj.png

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


<RadioGroup 
    android:id="@+id/radioGroup1" 
    android:layout_width="match_parent" 
    android:layout_height="55dp" android:background="@drawable/tilte2"> 



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


     <RadioButton 
      android:id="@+id/radioButton1" 
      android:layout_width="105dp" 
      android:layout_height="fill_parent" 
      android:layout_alignParentRight="true" 
      android:layout_centerVertical="true" 
      android:background="@null"/> 

     <RadioButton 
      android:id="@+id/radioButton3" 
      android:layout_width="105dp" 
      android:layout_height="fill_parent" 
      android:layout_alignParentLeft="true" 
      android:layout_centerVertical="true" 
      android:background="@null"/> 

     <RadioButton 
      android:id="@+id/radioButton2" 
      android:layout_width="105dp" 
      android:layout_height="fill_parent" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:background="@null"/> 

    </RelativeLayout> 

</RadioGroup> 

ответ

12

Если вам нужно настроить радио-кнопка выглядеть ..

Создать XML-селектор (radio_btn_selector.xml) в вытяжке папку как.

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:drawable="@drawable/pressed_image" 
    android:state_pressed="true"/> 
<item android:drawable="@drawable/checked_image" 
    android:state_checked="true"/> 
<item android:drawable="@drawable/focused_image" 
    android:state_focused="true" /> 
<item android:drawable="@drawable/default_image" /> 
</selector> 

Теперь используйте переключатель в качестве кнопки в кнопке Радио.

<RadioButton 
      android:id="@+id/radioButton2" 
      android:layout_width="105dp" 
      android:layout_height="fill_parent" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:background="@null" 

android:button="@drawable/radio_btn_selector" />

+0

Nice one !!! +1 для правильного ответа – Zoombie

0

Почему бы не использовать ToggleButton вместо этого? Радиоуправление без значка похоже на ToggleButton :)

Смежные вопросы