Android ListView onItemClick Not Work
Android ListView onItemClick Not Work
ListView item中有Button和RadioButton的时候,它的Item点击事件不起作用,需要设置item的属性。
- set the root layout with:
android:descendantFocusability="blocksDescendants" - set any focusable or clickable view in this item with:
android:clickable="false"android:focusable="false"android:focusableInTouchMode="false"
Here is an example: listview_item.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center_vertical"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"> <RadioButton
android:id="@+id/script_name_radio_btn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#000"
android:padding="5dp"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
/> </LinearLayout>
Android ListView onItemClick Not Work的更多相关文章
- Android开发(十六)——Android listview onItemClick事件失效的原因
参考: Android listview onItemClick事件失效的原因.http://blog.csdn.net/wangchun8926/article/details/8793178
- Android listview addHeaderView 和 addFooterView 详解
addHeaderView()方法:主要是向listView的头部添加布局addFooterView()方法:主要是向listView的底部添加布局 需要注意的是添加布局的时候应该添加从父容器开始添加 ...
- android ListView优化
android ListView通过优化重用历史缓存实现.listview相应的数据适配器一般使用自己定义BaseAdapter子类,重用历史缓冲区来提高性能. 例如,下面的示例代码演示: 1.lis ...
- Android 演示 Android ListView 和 github XListView(3-3)
本文内容 环境 项目结构 演示 1:简单 XListView 演示 2:XListView + Fragment 演示 3:XListView + ViewPager + Fragment 本文三个演 ...
- Android 演示 Android ListView 和 github XListView(1-3)
本文内容 环境 项目结构 演示 1:ListView 演示 2:简单 XListView 演示 3:音乐列表 XListView 演示 4:另一个音乐列表 XListView 本文四个演示,循序渐进. ...
- Android listview与adapter用法(BaseAdapter + getView)
Android listview与adapter用法http://www.cnblogs.com/zhengbeibei/archive/2013/05/14/3078805.html package ...
- Android ListView焦点事件冲突问题与解决
Android ListView对于单纯列表展示是很好用的,但是一旦牵扯到对listView进行操作就会遇到各种各样的问题.比如保存Checkbox状态与item复用的冲突.遇到可获取焦点的控件比如说 ...
- android ListView 九大重要属性详细分析、
android ListView 九大重要属性详细分析. 1.android ListView 一些重要属性详解,兄弟朋友可以参考一下. 首先是stackFromBottom属性,这只该属性之后你做好 ...
- 【腾讯Bugly干货分享】Android ListView与RecyclerView对比浅析--缓存机制
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/5811d3e3ab10c62013697408 作者:黄宁源 一,背景 Recy ...
随机推荐
- npm install 出现UNABLE_TO_GET_ISSUER_CERT_LOCALLY
解决方式 As a workaround you can turn ssl checking off in your .npmrc 执行 npm config set strict-ssl false ...
- nullcon HackIM 2016 -- Programming Question 5
Dont blink your Eyes, you might miss it. But the fatigue and exhaustion rules out any logic, any wil ...
- Win32 OpenGL标准例子
在VS2008的MSDN中有一个标准的OpenGL例子,记录如下: /* * Example of a Win32 OpenGL program. * The OpenGL code is the s ...
- js学习随笔
prompt 提示; parse解析;slice划分,切片;sort排序: 移除样式,removeAttribute("style") document.getElementByI ...
- Erp中的ATP和CTP是什么?两者有什么区别?
可用量承诺(Available to Promise,ATP),是一种库存匹配模型,意在最大限度地利用库存产品对客户订单需求做出及时和准确的反应,缩短交货提前期.降低库存水准: 可用生产能力承诺(Ca ...
- 《锋利的jQuery》(第2版)读书笔记4
第9章 jQuery Mobile jQuery Mobile是用来填补jQuery在移动设备应用上的缺憾的一个新项目. 它基于jQuery框架并使用HTML5和CSS3这些新的技术,除了能提供很多基 ...
- python 正则re模块
re.match re.match 尝试从字符串的开始匹配一个模式,如:下面的例子匹配第一个单词. import re text = "JGood is a handsome boy, he ...
- 打造 html5 文件上传组件,实现进度显示及拖拽上传,支持秒传+分片上传+断点续传,兼容IE6+及其它标准浏览器
老早就注册了博客园帐号,昨天才发现,连博客都没开,Github也是一样,深觉惭愧,赶紧潜个水压压惊`(*∩_∩*)′ 言归正传.大概许多人都会用到文件上传的功能,上传的库貌似也不少,比如(jQuery ...
- PHP标准注释
"php是一门及其容易入门的语言,刚入门的新手不到几分钟的时间可能就会用echo打印出一个hello world !但是他是真正的程序员吗?怎么来定义程序员呢?如果想真正成为一个程序员,那么 ...
- Tire树入门专题
POJ 3630Phone List 题目连接:http://poj.org/problem?id=3630 题意:问是否有号码是其他号码的前缀. #include<iostream> # ...