在Android ListView项的子元素(如按钮)的点击也越​​来越焦点 [英] On click of Android listview item's child elements (like button) are getting focus

查看:174
本文介绍了在Android ListView项的子元素(如按钮)的点击也越​​来越焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文字厂景

文字厂景

文字厂景

在项目按钮点击越来越关注的焦点。我不想让按钮的焦点,即使我已经在每个列表视图项的布局给予按钮的下列属性
 机器人:可聚焦=假
 机器人:focusableInTouchMode =假
任何一个请帮我出这个

on click of item buttons are getting focus. I don't want to get the focus of button even though i have given the following attributes of button in each listview item's layout android:focusable="false" android:focusableInTouchMode="false" Any one please help me out this

推荐答案

添加的android:descendantFocusability =blocksDescendants这样子View(行)可以阻止

Add android:descendantFocusability="blocksDescendants" so that child View(row ) can be blocked.

<ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:descendantFocusability="blocksDescendants" />

如果你想在台钳wersa 不是添加可聚焦和focusableInTouchMode为false 的ImageButton /按钮在item.xml

And if you want the vise wersa than add focusable and focusableInTouchMode to false to imageButton/Button in item.xml

这篇关于在Android ListView项的子元素(如按钮)的点击也越​​来越焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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