Luis Mendo Luis Mendo - 3 years ago 144
Android Question

Hide radio button icon but not text

I need to hide a radio button's icon: something like setting it to invisible, but only the icon, not the text (

hides also the text). The icon should still take up space, so that the text is aligned with that of the other radio buttons. Also, the radio button (its text) should be clickable.

In other words, what I want is for the icon to be "transparent" (not visible), but otherwise "be there": be clickable, take up space.

I need to do this programmatically, not in XML.

Any ideas?

Answer Source


   android:button="@android:color/transparent" />


RadioButton myButton = (RadioButton) findViewById(;
   myButton.setPadding(31, 0, 0, 0);

setPadding() takes int values that represent Padding in Pixels, see Definition@Google so adjust the Padding as required.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download