在Android ListView项的子元素(如按钮)的点击也越来越焦点 [英] On click of Android listview item's child elements (like button) are getting focus
问题描述
文字厂景
文字厂景
文字厂景
在项目按钮点击越来越关注的焦点。我不想让按钮的焦点,即使我已经在每个列表视图项的布局给予按钮的下列属性
机器人:可聚焦=假
机器人: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屋!