ListView onitemclick 不起作用

发布于 2024-12-06 06:32:34 字数 105 浏览 2 评论 0原文

我有一个 ListView,其中包含一个复选框、一个图像视图、两个文本视图和一个按钮。问题是添加复选框和按钮后,ListView 的 onitemclick 事件没有响应。有人会建议解决该问题吗?

I have a ListView containing a checkbox, an imageview, two textviews and a button. The problem is after adding the checkbox and the button the onitemclick event of the ListView is not responding. Will anybody suggest a work around for the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

救赎№ 2024-12-13 06:32:34

您可以将复选框的 android:focusableandroid:focusableInTouchMode 属性设置为 false ,并且列表的 onItemClick 将称为。但您必须在 onItemClick 中自行调用 CheckBox#toggle()

You can set both android:focusable and android:focusableInTouchMode attributes of checkbox to false and onItemClick of the list will be called. But you'll have to call CheckBox#toggle() yourself in onItemClick.

夏の忆 2024-12-13 06:32:34

将 onlick 监听器添加到视图中。或复选框并手动处理。

Add an onlick listner to the view. or the checkbox and handle it manually.

给妤﹃绝世温柔 2024-12-13 06:32:34

当您在 listview 中使用 checkbox 时,它会消耗您的点击操作并执行您的检查操作。

您可以将点击侦听器放在文本视图、图像视图或按钮上。您还需要处理复选框。

When you use checkbox in your listview then it consumes your click action and your check action will be performed.

You can put click listener over textview, imageview or button. you also need to handle checkbox.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文