什么是落实使用自定义阵列适配器一个Android的ListView单选单选按钮的最好方法? [英] What is the best way to implement single choice radio buttons on an android listview that uses a custom array adapter?

查看:134
本文介绍了什么是落实使用自定义阵列适配器一个Android的ListView单选单选按钮的最好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义的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);

希望这有助于!

这篇关于什么是落实使用自定义阵列适配器一个Android的ListView单选单选按钮的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆