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 ...
随机推荐
- 【docker】linux系统centOS 7上安装docker
要求: 一个centOS 7系统 虚拟就上安装CentOS 7步骤 本文操作在本机上使用xshell连接虚拟机上的centOS 7进行操作 1.Docker 要求 CentOS 系统的内核版本高于 ...
- java 数据流的处理
字节流类 功能简单介绍 DataInputStream 包含了读取Java标准数据类型的输入流 DataOutputStream 包含了写Java标准数据类型的输出流 ByteArrayInputSt ...
- [Android UI] Activity Maintheme (Android 解决程序启动时的黑屏问题)
<style name="MainTheme" parent="@android:style/Theme"> <item name=" ...
- MapReduce模式MapReduce patterns
After having modified and run a job in the last post, we can now examine which are the most frequent ...
- MySQL运行状态show status中文详解
状态名 作用域 详细解释 Aborted_clients Global 由于客户端没有正确关闭连接导致客户端终止而中断的连接数 Aborted_connects Global 试图连接到MySQL服务 ...
- 使用自由软件Icarus Verilog Simulator进行仿真
Icarus Verilog Simulator(http://iverilog.icarus.com/home)使用iverilog作为源代码编译器,编译生成vvp程序文本,使用vvp作为运行时引擎 ...
- 如何处理wordpress首页不显示指定分类文章
如何实现wordpress首页不显示指定分类文章,要实现这一步,首先必须找到需要屏蔽的该目录的id,那么如何查看wordpress的分类id呢?有两种方法: 通过wordpress后台查看分类的ID ...
- 关于NLPIR应用在KETTLE中的探索
一:什么是NLPIR? NLPIR汉语分词系统(自然语言处理与信息检索共享平台),主要功能包括中文分词:词性标注:命名实体识别:用户词典功能:支持GBK编码.UTF8编码.BIG5编码.新增微博分词. ...
- 历尽折腾,终于把Unity3D 的demo发布安卓啦(问题)
只要碰到两个比较蛋疼的问题: 1. Error generating final archive: Debug certificate expired on **** 从字面了解,是由于Debug证书 ...
- textarea光标移到末尾兼容ie,ffchrome
function moveEnd(obj){ obj.focus(); var len = obj.value.length; if (document ...