且构网

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

ListView控件元素无法点击

更新时间:2022-02-17 23:10:41

我碰到这样的一些问题,也这似乎是与组合的的ListView S上点击听众和那些我在适配器分配每个单项

I faced some issues with this, too, which seemed to be related to the combination of the ListView's on click listeners and those I assigned each individual item in my Adapter.

在我的 Adapter.getView()我必须以确保项目进行配置,如:

In my Adapter.getView() I had to make sure the items were configured like:

item.setLongClickable( false );
item.setClickable( false );
item.setOnClickListener( null ); 

而我的的ListView 必须有它的 OnItemClickListener 和/或它的 OnItemLongClickListener 设置。

while my ListView had to have its OnItemClickListener and/or its OnItemLongClickListener set.

打开对个别项目的点击的的在列表视图是行不通的。也许这是什么导致你的问题了。

Turning on clicks on the individual items and on the listview would not work. Maybe that's what's causing your issue, too.