列表视图项目单击无法工作视图、单击、项目、列表

由网友(笙)分享简介:我在我的ListView显示的ImageButton一个ListView。 我设置focusalble假和focusableInTouchMode假来的ImageButton。 我设置ListView.OnItemClickListner。当我运行我的项目,这是展示我的ListView。 不过,当我点击列表视图它不工作...

我在我的ListView显示的ImageButton一个ListView。

我设置focusalble假和focusableInTouchMode假来的ImageButton。

我设置ListView.OnItemClickListner。当我运行我的项目,这是展示我的ListView。

不过,当我点击列表视图它不工作。

然后,我删除ImageButton的布局,然后再次运行我的项目,当我点击的ListView它的工作

有什么错?

解决方案

 机器人:可调焦=假
机器人:focusableInTouchMode =假
 

不适合的ImageButton工作

在你的布局XML,这个属性添加到根布局

 安卓descendantFocusability =blocksDescendants
 
西门子S7 1200 1500与精简面板仿真的详细图解

它完美的一个ListView具有的ImageButton。

I have a ListView in my ListView show ImageButton.

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

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

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

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

What wrong ?

解决方案

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

doesn't work for ImageButton.

In your layout xml, add this property to root layout

android:descendantFocusability="blocksDescendants" 

It works perfectly for a listview that has ImageButton.

阅读全文

相关推荐

最新文章