ListView的item中有button和checkbox,listview的点击事件无效,解决办法:

在item布局文件中的根控件中添加属性设置:

android:descendantFocusability="blocksDescendants"

如果只能点击checkbox,而无法触发item的点击事件,那么可以禁掉checkbox的焦点获取,不让它可以点击就可以了

checkbox里面加

android:focusable="false"
android:clickable="false"

ListView的item中有button和checkbox,listview的点击事件无效的更多相关文章

  1. Android中ListView中有button,checkbox,GridView时事件问题

    最近做项目,用到了listview的item的一些问题,现在抽空把它们总结一下: 转载请表明出处:http://blog.csdn.net/wdaming1986/article/details/67 ...

  2. 区分listview的item和Button的点击事件

    这两天修改领导通的ListView widget,在ListView中加入Button这类的有 “点击” 事件的widget,发现原来listview的itemclick居然失效了, 后来在网上查资料 ...

  3. Listview的Item中有CheckBox、Button等的焦点处理

    ListView的item布局中有CheckBox.Button等会获取焦点的控件会抢走焦点,造成ListView的item点击事件相应不了. 解决方法:控件设置 android:clickable= ...

  4. android Listview item 中有button,item就不响应触摸事件

    为button设置 beanButton.getButton().setFocusable(false); beanButton.getButton().setFocusableInTouchMode ...

  5. ListView item中有button或EditText时 点击事件失效问题的解决

    加入:android:descendantFocusability="blocksDescendants" 代码如下: <LinearLayout xmlns:android ...

  6. listView获取item的Edit内容,listView中的edit内容在滚动时自动赋值了前面的内容

    Today I am going to explain how to create a ListView with EditText and why will we need a TextWatche ...

  7. jquery 点击tr选中checkbox,解决checkbox的默认点击事件被阻止的问题

        1.第一种,!$(event.target).is('input'),判断触发事件的元素是否为input.此时使用event.target,而不是this,获取事件本身,防止触发事件冒泡的问题 ...

  8. android 使用动画 Button移动后不响应点击事件的解决办法

    animation3.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimatio ...

  9. listview 的onitemlongclick阿和onitemclick冲突,item中还有button的点击事件

    listview里面item有button的,button要设置 android:focusable="false"  ,listview里面如果设置了 onitemlongcli ...

随机推荐

  1. leetcode@ [279]Perfect Squares

    https://leetcode.com/problems/perfect-squares/ Given a positive integer n, find the least number of ...

  2. 基于Qt的P2P局域网聊天及文件传送软件设计

    基于Qt的P2P局域网聊天及文件传送软件设计 zouxy09@qq.com http://blog.csdn.net/zouxy09         这是我的<通信网络>的课程设计作业,之 ...

  3. 【STL学习】智能指针之weak_ptr

    简介 weak_ptr是shared_ptr的观察者,它不会干扰shared_ptr所共享对象的所有权,当一个weak_ptr所观察的shared_ptr要释放它的资源时,它会把相关的weak_ptr ...

  4. 解决 mac ssh空闲 连接断开问题

    想必大家都知道,用终端 ssh 连接服务器,如果长时间没有操作,会被断开连接. 要用的话又得重新登录,这非常不方便,也影响开发效率.那针对这种情况,有没有解决方法呢? 答案是肯定的.理论上,有两种方案 ...

  5. Gitbook 使用入门

    GitBook 是一个基于 Node.js 的命令行工具,可使用 Github/Git 和 Markdown 来制作精美的电子书. 本书将简单介绍如何安装.编写.生成.发布一本在线图书. http:/ ...

  6. HDU 1718 Rank counting sort解法

    本题是利用counting sort的思想去解题. 注意本题,好像利用直接排序,然后查找rank是会直接被判WA的.奇怪的推断系统. 由于分数值的范围是0到100,很小,而student 号码又很大, ...

  7. SHGetSpecialFolderLocation

    uses shlobj;function GetDesktopFolder():string;var  pItem: PItemIDList;  temp: array[0..MAX_PATH] of ...

  8. cocos2d-x3.1.1 step by step 学习笔记1----- 软件的安装与HelloWord

    1:软件安装 系统:WIn7 软件:VS2012.cocosd-x3.1.1.python2.6.7.doxygen <1>首先安装VS2012,安装也是傻瓜式安装, <2>然 ...

  9. ios的NSMutableString用法

    版权声明:本文为博主原创文章,未经博主允许不得转载. 详见代码: // //  main.m //  Foundation5-NSMutableString // //  Created by mj  ...

  10. 重现PHP Core的调用栈

        以前, 我曾经介绍过如何通过PHP的Core文件获取信息:如何调试PHP的Core之获取基本信息, 对于调用参数这块, 当时介绍的获取方法比较复杂. 于是今天我为PHP 5.4的.gdbini ...