2014-07-26 18 views
5

enter image description herePulsante radio Android: Rimuovi padding sinistro

Ciao Ho un problema come mostrato sopra. Il problema che sto affrontando è che sembra esserci un riempimento invisibile alla sinistra del pulsante di opzione come elencato sopra. La mia domanda è che questo è dovuto a un problema estraibile con la radio o posso modificare un attributo per farlo allineare con il mio testo e campi di input. Se ho bisogno di usare un drawable alternativo, ce n'è uno che posso ottenere dall'SDK senza margini/padding?

<LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
... stuff 
    <RadioGroup 
       android:layout_margin="0dp" 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 
       <RadioButton 
        android:id="@+id/radio_free_busy" 
        android:checked="true" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:drawablePadding="0dp" 
        android:text="@string/label_invitation_free_busy" 
        /> 
       <RadioButton 
        android:id="@+id/radio_free_busy_plus" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/label_invitation_free_busy_plus" 
        /> 
       <RadioButton 
        android:id="@+id/radio_none" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/label_invitation_none" 
        /> 
      </RadioGroup> 
</LinearLayout> 

sembra essere dovuto al drawable ... se qualcuno ha un'alternativa sarebbe utile

+0

Potete mostrare il codice per favore? –

+0

Inserito il codice di layout – adrian

+0

Sei sicuro di non aver impostato alcun margine/riempimento in quella vista padre di RadioGroup? – joao2fast4u

risposta

2

Hai ragione. Ho provato e ho aggiunto un margine negativo a sinistra.

questo è il risultato:

enter image description here

Questo è quello che ho fatto:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<RadioGroup 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="-3dp" 
    android:orientation="vertical" > 

    <RadioButton 
     android:id="@+id/radio_free_busy" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:checked="true" 
     android:drawablePadding="0dp" 
     android:text="Free busy" /> 

    <RadioButton 
     android:id="@+id/radio_free_busy_plus" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Invitation free busy plus" /> 

    <RadioButton 
     android:id="@+id/radio_none" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Invitation none" /> 
</RadioGroup> 

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="20dp" 
    android:text="Whate name should people in this group see ?" /> 

+0

Sì, l'ho appena visto dopo aver letto una guida sui pulsanti radio – adrian