Listview itemclick 不起作用 [英] Listview itemclick not work

查看:37
本文介绍了Listview itemclick 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我的 ListView 中有一个 ListView 显示 ImageButton.

  1. I have a ListView in my ListView show ImageButton.

我将 focusalble "false" 和 focusableInTouchMode "false" 设置为 ImageButton.

I set focusalble "false" and focusableInTouchMode "false" to ImageButton.

我设置了 ListView.OnItemClickListner.当我运行我的项目时,它会显示我的 ListView.

I set ListView.OnItemClickListner. When I run my project It's show my ListView.

但是当我点击 Listview 时它不起作用.

But When I click on Listview It's not working.

然后我删除布局中的 ImageButton 并在单击 ListView 时再次运行我的项目

Then I remove ImageButton in layout and run my project again when i click ListView It' work

怎么了?

推荐答案

android:focusable="false"
android:focusableInTouchMode="false"

不适用于 ImageButton.

doesn't work for ImageButton.

在您的布局 xml 中,将此属性添加到根布局

In your layout xml, add this property to root layout

android:descendantFocusability="blocksDescendants" 

它非常适合具有 ImageButton 的列表视图.

It works perfectly for a listview that has ImageButton.

这篇关于Listview itemclick 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆