Radiobutton with text on top
Asked Answered
T

1

1

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>
Tripper answered 11/4, 2012 at 13:19 Comment(3)
what do you exactly want tell me?Coverture
try using RadioButton gravity.Sybyl
How should the gravity help? I want it on top/above visually on top like in Z axis not x/y axis. The problem is the image sits on top of the text so you can't read it...Tripper
M
3

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

Mammiemammiferous answered 11/4, 2012 at 13:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.