什么是落实使用自定义阵列适配器一个Android的ListView单选单选按钮的最好方法?单选、自定义、阵列、适配器

由网友(生死悠关组合!)分享简介:我创建了一个自定义的arrayadapter来处理JSON响应说我成功地掷入列表视图。不过,我不确定要显示单选按钮旁边的每一个项目。我读过有关使用android.R.layout.simple_list_item_single_choice作为默认视图的最佳方式,但我使用自定义适配器和一个自定义XML显示我的数据,所以...

我创建了一个自定义的arrayadapter来处理JSON响应说我成功地掷入列表视图。不过,我不确定要显示单选按钮旁边的每一个项目。我读过有关使用android.R.layout.simple_list_item_single_choice作为默认视图的最佳方式,但我使用自定义适配器和一个自定义XML显示我的数据,所以,我想知道在这种情况下什么是实现一个列表视图单选按钮的最好方法? THX

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

推荐答案

我觉得这可以帮你。

只需更改行

getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);

希望这有助于!

阅读全文

相关推荐

最新文章