Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radio Button with image as an option instead of text

Tags:

How can i add radio buttons in android app with option as an image , not the text.. we can set the text to radio button by android:setText property. But i want an image to be displayed there and not the text.. Please help me?

like image 352
Cool Compiler Avatar asked Jun 18 '12 11:06

Cool Compiler


People also ask

How do I make an image slider work with radio buttons?

We will use radio buttons to select the image that we want to see from the image slider by giving an unique id to each radio button. Next, we will embed all the images one by one and create labels for radio button id's and will apply necessary CSS properties to achieve the desired output.

How do I make radio buttons with text?

To label a radio button, add a <label> element after the <input> element and insert a for attribute with the same value as the id of the associated <input> element. Then, write your label text in the <label> tag.


1 Answers

How about this one using the property android:drawableRight?

<RadioGroup     android:id="@+id/maptype"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_below="@+id/line1"     android:orientation="horizontal" >     <RadioButton         android:id="@+id/map"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:checked="true"         android:drawableRight="@drawable/map" />      <RadioButton         android:id="@+id/satellite"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:drawableRight="@drawable/sat" /> </RadioGroup> 
like image 123
Joseph Selvaraj Avatar answered Nov 07 '22 17:11

Joseph Selvaraj