如何做按钮的点击和列表视图项单击在Android的定制列表视图视图、列表、单击、如何做

2023-09-06 13:33:54 作者:慕凡

我有4个项目在我的列表视图中的这3个是文本视图,一个是在我的情况按钮,我已经从一个单一的列表中打开了2个新的活动

I have 4 items in my list view in these 3 are text view and one is button in my case i have to open 2 new activities from a single list

从按钮点击1号 从列表视图项点击第二个

1st from on button click 2nd from on list view item click

但是当我加入列表视图列表中单击不工作的按钮,也我不能够处理按钮的点击。

but when i add the button in list view list click is not working, also i am not able to handle the click of button.

我使用BaseAdapter类设置数据列表视图。

I am using BaseAdapter class to set the data in list view.

请帮我解决这个问题。

感谢。

推荐答案

或者你可以设置为您按钮

Or you can just set to you button

android:focusable="false"

在这种情况下,你的ListView将触发onItemClick动作监听器,按钮也将工作时它点击。

In this case you ListView will fire onItemClick action to listener, and the Button will also work when it clicked.