EsbenG
EsbenG

Reputation: 28162

Radiobutton with text on top

How do you make a radiobutton where you change the drawable with android:button and have text on top? with regular radio buttons the text is layered behind the drawable.

Right now I'm starting to get out in a frustrated implementation of my own radiobutton.

I want something like this:

<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <RadioButton
        android:text="something that is on top"
        android:id="@+id/toggle_tab_left"
        android:button="@drawable/main_selector"
        style="@style/TabStyle"/>
    <RadioButton 
        android:button="@drawable/info_selector"
        android:text="something that is on top"
        android:id="@+id/toggle_tab_right"
        style="@style/TabStyle"/>
</RadioGroup>

Upvotes: 1

Views: 2931

Answers (1)

Jave
Jave

Reputation: 31856

You can use the background attribute for the graphic instead, and set the button to @null or a transparent color.

Upvotes: 3

Related Questions