开发者

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 !!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜