Android Tutorial–Customized Radio Button List

Radio buttons are almost always used to represent single choice from a list of items. Android is no exception to that.

Android provides two ways to use radio buttons. At a higher level, it allows one to use radio button list in ListActivity by setting the choice mode, as indicated in the code below,

public class List10 extends ListActivity {


    public void onCreate(Bundle savedInstanceState) {


        setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_single_choice, CONTENT));

        final ListView listView = getListView();




    private static final String[] CONTENT = new String[] {

        "Action", "Adventure", "Animation", "Children", "Comedy", "Documentary", "Drama",

        "Foreign", "History", "Independent", "Romance", "Sci-Fi", "Television", "Thriller"



The effect is as below,


At a lower level, one can create radio button list by using RadioGroup and RadioButton. One can find the detailed code in the source file downloadable at the end of this post. The effect of this method is as below,


However, the lower level default radio button only allows one to place the text on the right of the button, and the higher level method is also difficult to customize. But one can always build a radio button list from scratch.

The method is to place a radio button and a text view in a linear layout to form a single item and then use it as the element to build list view. The effect is as below,sc2

The complete code can be downloaded from here.

0 thoughts on “Android Tutorial–Customized Radio Button List”

  1. Very useful information. Can you tell me please how to make one of the selections a default? The idea is to make the first choice of the list already clicked, just in case the user will not choose anything?

  2. In case I want to add a button at the foot of the radio button list ( referring to the first screen shot ). how do i go about that? Any attempts that I made for the same resulted in the radio button assignment being lost.

Leave a Reply

Your email address will not be published. Required fields are marked *