带有可点击/可编辑小部件的 ListView [英] ListView with clickable/editable widget
问题描述
当项目布局具有可点击/可编辑小部件(RadioButton、EditText 或 CheckBox)时,是否可以在 ListView 上使用 OnItemClickListener?
Is it possible to use a OnItemClickListener on a ListView when the Items layout has a clickable/editable widget (RadioButton,EditText, or CheckBox)?
推荐答案
你可能想看看 这个问题.在 ListView
的一行中有一个可聚焦的项目会导致 OnItemClickListener
不被调用.但是,这并不意味着您不能连续拥有可聚焦/可点击的项目,有一些解决方法,例如 这个.
You might want to take a look at this issue. Having a focusable item in a row of a ListView
causes the OnItemClickListener
NOT to be invoked. However, that does not mean you cannot have focusable/clickable items in a row, there are some workarounds like this one.
此外,您还可以查看通话记录屏幕.它有一个带有可点击项的 ListView
(右侧的呼叫图标).在此处查看源代码
Also, you can take a look at the Call Logs screen. It has a ListView
with clickable item(the call icon on the right).
See Source code here
这篇关于带有可点击/可编辑小部件的 ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!