当前位置: 首页 > news >正文

ListView(二)

head.xml布局文件代码:

<?xmlversion="1.0"encoding="utf-8"?>

<TableLayoutxmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation="horizontal"

    android:layout_width="fill_parent"

    android:layout_height="35px"  android:stretchColumns="0,1,2">

<TableRow>

 <TextViewandroid:layout_width="fill_parent" 

    android:layout_height="35px"android:text="NAME"/>

<TextViewandroid:layout_width="fill_parent"

    android:layout_height="35px"android:text="SEX"/>

<TextViewandroid:layout_width="fill_parent"

    android:layout_height="35px"android:text="AGE"/>

 </TableRow>

</TableLayout>

Item布局文件代码:

<?xmlversion="1.0"encoding="utf-8"?>

<TableLayoutxmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation="horizontal"

    android:layout_width="fill_parent"

    android:layout_height="35px"  android:stretchColumns="0,1,2">

<TableRow>

 <TextViewandroid:layout_width="fill_parent" 

    android:layout_height="35px"android:id="@+id/name"/>

<TextViewandroid:layout_width="fill_parent"

    android:layout_height="35px"android:id="@+id/sex"/>

<TextViewandroid:layout_width="fill_parent"

    android:layout_height="35px"android:id="@+id/age"/>

 </TableRow>

</TableLayout>

Activity中的监听器代码:

@Override

    protected void onListItemClick(ListView l, View v, int position, long id) {

       // TODO Auto-generated method stub

       HashMap<String,String> item=(HashMap<String,String>)(mItems.get(position-1));

       String info=item.get(mCloumns[0]).toString()+"    "+item.get(mCloumns[1]).toString()+

              item.get(mCloumns[2]).toString();

       Toast.makeText(ListViewDemo.this, info, Toast.LENGTH_LONG).show();

       super.onListItemClick(l, v, position, id);

    }

 

转载于:https://www.cnblogs.com/itfenqing/archive/2011/08/29/4429530.html

相关文章:

  • Flex--水晶按钮
  • Links to sample code for the Windows Phone 7
  • [30期] 我的学习方法
  • 莫名的PAMIE错误
  • Apache2.2虚拟主机添加多域名
  • 一起谈.NET技术,使用VS2010为Windows7编写一个杀手级WPF应用
  • HDU_1158 Employment Planning(DP)
  • 如何解决文件夹不能删除的情况
  • MPLS 标签分发详解
  • oracle 函数WMSYS.WM_CONCAT()的用法(让查询结果行转列)
  • 我的第一篇博客 Java数据流_1
  • 窗体点击,空白处隐藏(stopPropagation)
  • .NET中的十进制浮点类型,徐汇区网站设计
  • 一些优秀软件收藏
  • 瑞星推出杀毒新品 预掀31.5元抢购热潮
  • ----------
  • 【划重点】MySQL技术内幕:InnoDB存储引擎
  • 2017-08-04 前端日报
  • 230. Kth Smallest Element in a BST
  • JavaScript函数式编程(一)
  • mysql常用命令汇总
  • Node项目之评分系统(二)- 数据库设计
  • Promise面试题2实现异步串行执行
  • vue2.0开发聊天程序(四) 完整体验一次Vue开发(下)
  • 大主子表关联的性能优化方法
  • 免费小说阅读小程序
  • 实战:基于Spring Boot快速开发RESTful风格API接口
  • 小程序测试方案初探
  • 用quicker-worker.js轻松跑一个大数据遍历
  • 看到一个关于网页设计的文章分享过来!大家看看!
  • 如何通过报表单元格右键控制报表跳转到不同链接地址 ...
  • #define用法
  • (1)(1.19) TeraRanger One/EVO测距仪
  • (20)目标检测算法之YOLOv5计算预选框、详解anchor计算
  • (4)logging(日志模块)
  • (超简单)构建高可用网络应用:使用Nginx进行负载均衡与健康检查
  • (附源码)ssm教材管理系统 毕业设计 011229
  • (附源码)ssm旅游企业财务管理系统 毕业设计 102100
  • (论文阅读31/100)Stacked hourglass networks for human pose estimation
  • (十七)devops持续集成开发——使用jenkins流水线pipeline方式发布一个微服务项目
  • (转)Scala的“=”符号简介
  • ****** 二 ******、软设笔记【数据结构】-KMP算法、树、二叉树
  • .mysql secret在哪_MYSQL基本操作(上)
  • .Net Remoting(分离服务程序实现) - Part.3
  • .NET 简介:跨平台、开源、高性能的开发平台
  • .NET 解决重复提交问题
  • .Net+SQL Server企业应用性能优化笔记4——精确查找瓶颈
  • .NET精简框架的“无法找到资源程序集”异常释疑
  • .Net中的集合
  • [ 英语 ] 马斯克抱水槽“入主”推特总部中那句 Let that sink in 到底是什么梗?
  • [AutoSar]工程中的cpuload陷阱(三)测试
  • [BUUCTF]-PWN:[极客大挑战 2019]Not Bad解析
  • [HJ56 完全数计算]
  • [HJ73 计算日期到天数转换]
  • [JavaEE] 线程与进程的区别详解