1

I want to style radio buttons and show icons instead as

Icon images

I have radio buttons radio group as

<RadioGroup android:id="@+id/detial_options"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_gravity="center_vertical">

    <RadioButton android:id="@+id/bus"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_gravity="center_vertical"
        android:background="@drawable/bus"/>
    <RadioButton android:id="@+id/train"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_gravity="center_vertical"
        android:background="@drawable/train"/>
    <RadioButton android:id="@+id/plane"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_gravity="center_vertical"
        android:background="@drawable/plane" />
    <RadioButton android:id="@+id/pluse"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_gravity="center_vertical"
        android:background="@drawable/pluse" />
</RadioGroup>

one of my drawables is

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_checked="true"
        android:drawable="@mipmap/bus_light" />
    <item
        android:state_checked="false"
        android:drawable="@mipmap/bus_dark" />
</selector>

and all other three for train, plane and pluse are same as above except icons, when I apply the above things I get radio buttons as

icons with borders

mean to say there is still radio button border in back ground, how can I remove that and get the icons as in first image.

  • 2
    Did you try to set the `button` attribute to transparent: `android:button="@android:color/transparent"` in your RadioButton? Or try with `android:button` instead of `android:background`. – Blo Nov 05 '15 at 15:44
  • 2
    Check out http://stackoverflow.com/questions/19163628/adding-custom-radio-buttons-in-android – Shvet Nov 05 '15 at 15:46
  • @Fllo thanks that solved my issue! Thanks again.... –  Nov 05 '15 at 15:51

0 Answers0