What is the best way to implement single choice radio buttons on an android listview that uses a custom array adapter?
I've created a custom arrayadapter to handle a json response that I'm successfully throwing into a listview. However, I'm unsure of the best way to display radio buttons next to each item... I've read abo开发者_JAVA技巧ut using android.R.layout.simple_list_item_single_choice as the default view, but I'm using a custom adapter and a custom xml to display my data... so I'm wondering in this case what is the best way to implement radio buttons on a listview? thx
I think this can help you.
Just change the line
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
to
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
Hope this helps !!
精彩评论