ListView中Button事件
为了解决ListView中Item里的Button独立事件响应,能够採用下面方法:
在BaseAdapter的getview里加入加粗代码:
<span style="font-size:14px;">@Override
public View getView(int position, View view, ViewGroup arg2) {
view = layoutInflater.from(context).inflate(
R.layout.sport_user_list_item, null); TextView text1 = (TextView) view.findViewById(R.id.user_name);
TextView text2 = (TextView) view.findViewById(R.id.user_grade); Button button1 = (Button) view.findViewById(R.id.challenger_btn); text1.setText("姓名");
text2.setText("等级"); String user = sportUserList.get(position).getUser();
UserCode[] codes = challengeDBAdapter.queryOneData(user); if (codes == null) {
text6.setVisibility(8);
<span style="font-size:18px;"><strong>button1.setTag(position + "");</strong></span> button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { <strong><span style="font-size:18px;">int temp = Integer.parseInt(v.getTag().toString()) ;</span></strong>
// 设置验证码
SetChallengeCodeThread codeThread = new SetChallengeCodeThread(temp);
codeThread.start(); }
});
} else {
text6.setText(codes[0].getCode() + "");
button1.setVisibility(8);
} return view;
}
</span>
ListView中Button事件的更多相关文章
- Android Listview中Button按钮点击事件冲突解决办法
今天做项目时,ListView中含有了Button组件,心里一早就知道肯定会有冲突,因为以前就遇到过,并解决过,可惜当时没有记录下来. 今天在做的时候,继续被这个问题郁闷了一把,后来解决后,赶紧来记录 ...
- android ListView中button点击事件盖掉onItemClick解决办法
ListView 1.在android应用当中,很多时候都要用到listView,但如果ListView当中添加Button后,ListView 自己的 public void onItemClick ...
- Android实战简易教程-第十五枪(实现ListView中Button点击事件监听)
1.main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" x ...
- ListView中button监听器 设置 及 优化
在应用开发中常常会用到ListView,而且每个Item里面都会有button之类的须要进行事件监听的控件.在给button加入OnClickListener的时候,一開始非常下意识的会想在ListV ...
- flex中Button事件中的e.target
关于flex中的Button事件中的e.target. 今天想在事件中调用模块中的对象通过e.target获取单击的这个Button对象,但是可能是使用var btn:Button = e.targe ...
- listview中button抢占焦点问题
解决办法Item xml 根节点添加 android:descendantFocusability="blocksDescendants" Button 设置 android:fo ...
- [转]Android监听ListView里Button事件
本文转自:http://blog.csdn.net/lovediji/article/details/6753349 public View getView(int position, View co ...
- winform实现listview中combox
一.概要 因为要在项目中要在ListView中实现下拉框选择,用DataGrid的话,一个不美观,二个绑定数据麻烦,参考网上一种做法,就是单击ListView时,判断单击的区域,然后将Combox控件 ...
- ListView中的组件Button的OnClick事件触发时机
Android开发时,ListView中的组件Button的OnClick事件必须在ListView之外的组件事件触发后才能触发? 此处ListView无OnItemClick事件,而且ListVie ...
随机推荐
- 【spring cloud】spring cloud Sleuth 和Zipkin 进行分布式链路跟踪
spring cloud 分布式微服务架构下,所有请求都去找网关,对外返回也是统一的结果,或者成功,或者失败. 但是如果失败,那分布式系统之间的服务调用可能非常复杂,那么要定位到发生错误的具体位置,就 ...
- facebook开源项目集合
Facebook的开源大手笔 1. 开源Facebook平台代码 Facebook在2008年选择将该平台上的重要部分的代码和应用工具开源.Facebook称,平台已经基本发展成熟,此举可以让开发 ...
- Spring+Quartz的版本问题
使用Spring配置管理Quartz的时候会遇到下面的异常: Caused by: java.lang.IncompatibleClassChangeError: class org.springfr ...
- 利用 FastCoding 将对象进行本地持久化
FastCoding https://github.com/nicklockwood/FastCoding A faster and more flexible binary file format ...
- fisher精确检验(fisher’s exat test)和超几何分布
- MyBatis使用Collection查询多对多或一对多结果集bug
情况描述:当使用JOIN查询,如果SQL查询出来的记录不是按id列排序的,则生成的List结果会有问题 案例: 1) 数据库模型 简而言之一个Goods包含多个Goods_Img 2) Java Be ...
- HBase目录
1. HBase介绍及简易安装(转) 2. java操作Hbase实例 3. HBase入门基础教程之单机模式与伪分布式模式安装(转) 4. HBase教程 5. 用Java操纵HBase数据库(新建 ...
- 第十四章 springboot + profile(不同环境读取不同配置)
具体做法: 不同环境的配置设置一个配置文件,例如:dev环境下的配置配置在application-dev.properties中:prod环境下的配置配置在application-prod.prope ...
- mysql09---sql语句优化
Sql语句本身的优化 问题是: 如何从一个大项目中,迅速的定位执行速度慢的语句. (定位慢查询) 首先我们了解mysql数据库的一些运行状态如何查询(比如想知道当前mysql运行的时间/一共执行了多少 ...
- Terrain tessellation &&Threaded Rendering Vk
https://github.com/NVIDIAGameWorks/GraphicsSamples/tree/master/samples/es3aep-kepler/TerrainTessella ...