且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ListView控件与OnItemClickListener机器人

更新时间:2023-02-22 20:15:26

虽然一个非常古老的问题,但我仍然张贴的答案,这使得它可以帮助一些之一。 如果您正在使用的列表视图中的任何布局,然后使用...

Though a very old question, but I am still posting an answer to it so that it may help some one. If you are using any layout inside the list view then use ...

android:descendantFocusability="blocksDescendants"    

...就行了里面的第一个父布局。这可以作为魔术的点击不会被列表中的任何元素被消耗掉,但将直接进入该列表项。

... on the first parent layout inside the list. This works as magic the click will not be consumed by any element inside the list but will directly go to the list item.