ListView item中有button或EditText时 点击事件失效问题的解决
加入:android:descendantFocusability="blocksDescendants"
代码如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/listitem_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/gridRowHeight"
android:descendantFocusability="blocksDescendants"
android:orientation="horizontal">
<TextView
style="@style/gridRow"
android:id="@+id/tvShortCode"
android:layout_weight="1.4"
android:text="简码"/>
<TextView
style="@style/gridRow"
android:id="@+id/tvItemName"
android:layout_weight="1"
android:text="商品名称"/>
<TextView
style="@style/gridRow"
android:id="@+id/tvKind"
android:layout_weight="1.4"
android:text="品类"/>
<TextView
style="@style/gridRow"
android:id="@+id/tvPri"
android:layout_weight="1.4"
android:text="零售价"/>
<EditText
style="@style/singleEdit"
android:id="@+id/edtValue"
android:layout_weight="1.3"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:numeric="integer"
android:gravity="center"
android:text="库存"/>
</LinearLayout>
<LinearLayout
android:id="@+id/layInput"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:padding="5dp"
android:visibility="gone"
android:orientation="vertical" >
<EditText
style="@style/singleEdit"
android:id="@+id/edtValue"
android:layout_weight="1.3"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:numeric="integer"
android:gravity="center"
android:text="库存"/>
<Button
android:id="@+id/btnSaved"
style="@style/button"
android:layout_width="fill_parent"
android:layout_marginTop="10dp"
android:text="完 成"/>
</LinearLayout>
</LinearLayout>
ListView item中有button或EditText时 点击事件失效问题的解决的更多相关文章
- Android ListView item 点击事件失效问题的解决
关于ListView点击无效,item无法相应点击事件的问题,网上有很多, 大致可分为俩种情况, 一种是 item中存在 ImageButton 等可以点击的组件,这会抢先获得ListView的焦点. ...
- android Listview item 中有button,item就不响应触摸事件
为button设置 beanButton.getButton().setFocusable(false); beanButton.getButton().setFocusableInTouchMode ...
- ListView的item中有button和checkbox,listview的点击事件无效
ListView的item中有button和checkbox,listview的点击事件无效,解决办法: 在item布局文件中的根控件中添加属性设置: android:descendantFocusa ...
- ListView点击事件失效(item里面有button按钮控件)解决方法
ListView点击事件失效解决方法: 一般出现这个情况,就是你的item里面有按钮的点击事件,你的item里面有button控件,button控件是抢占焦点的,只要在你的item布局里面这样子写就可 ...
- ListView中嵌入布局的Button或多个点击事件
有时候在ListView嵌入的布局中有多个事件需要点击,比如一个item中有TextView和Button两个布局,当我们需要获取这两个点击事件时,我们应该如何去获取呢,通常来说,我们都是已经固定好了 ...
- Android ListView中Item点击事件失效解决方案
欢迎关注公众号,每天推送Android技术文章,二维码如下:(可扫描) 在平常的开发过程中,我们的ListView可能不只是简单的显示下文本或者按钮,更多的是显示复杂的布局,这样的话,我们就得自己写布 ...
- ListVIew点击事件失效
转自:http://blog.csdn.net/zhufuing/article/details/8677407 记录下自己所犯的错误,在写ListView的点击事件时OnItemClickListe ...
- 使用PullToRefreshListView时遇到Item点击事件失效问题 解决方法
最近在自己的项目中使用到了以下开源项目: https://github.com/nanchen2251/pullToRefreshDemo 相关介绍博客如下: http://www.cnblogs.c ...
- android ListView中button点击事件盖掉onItemClick解决办法
ListView 1.在android应用当中,很多时候都要用到listView,但如果ListView当中添加Button后,ListView 自己的 public void onItemClick ...
随机推荐
- python中的命名元组namedtuple
namedtuple是继承自tuple的子类.namedtuple创建一个和tuple类似的对象,而且对象拥有可访问的属性 可利用collections.namedtuple构建一个简单的类. fro ...
- http协议与常见状态码
什么是http: http是属于应用层(基于tcp的连接方式)的面向对象的协议,是计算机通过网络通信的规则,使得浏览器向web服务器请求信息和服务 http协议特点: http是一种无状态协议(对食物 ...
- JAVA jar 参数
-client to select the "client" VM -server to select the "server" ...
- 【Android内存泄漏检测】LeakCanary使用总结
一.什么是LeakCanary? LeakCanary就是用来检测Android端内存泄漏的一个工具.能够检测Activity的泄漏 什么是内存泄漏? Java 对象有时也会”长死不死“,GC 拿它没 ...
- json的内容回顾
复习一下json这个模块 import json s = '{"name":"cui","age":12}' # 这里外部必须是单引号,内部 ...
- linux命令学习之:touch
touch命令有两个功能:一是用于把已存在文件的时间标签更新为系统当前的时间(默认方式),它们的数据将原封不动地保留下来:二是用来创建新的空文件. 语法 touch(选项)(参数) 选项 -a:或-- ...
- php libev扩展使用
在WorkerMan源码分析 - 实现最简单的原型文章中提到了libevent网络库,前者和libev都是事件驱动编程库高性能.简单说libev对libevent做了改进和精简.libevent使用全 ...
- SeekBar
<SeekBar android:id=”@+id/seek”android:layout_width=”match_parent”android:layout_height=”wrap_con ...
- (四)创建ROS程序包(就是软件包)
你的 ROS 程序包都放到下面这个目录里, 切换到这个目录: $ cd ~/catkin_ws/src 使用下面的命令: 创建一个 ROS 程序包 名字就叫:beginner_tutorials $ ...
- sqlserver打开对象资源管理器管理的帮助文档的快捷键
sqlserver打开对象资源管理器管理的帮助文档的快捷键:Fn+F1