界面显示两个ListView
1.List界面布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:id="@+id/titleRelativeLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/title_height"
android:background="@color/title_background"
android:orientation="horizontal">
<ImageView
android:id="@+id/backImage"
android:src="@drawable/return_key_p"
android:layout_width="wrap_content"
android:layout_height="@dimen/title_height"
android:layout_marginLeft="@dimen/button_left"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/titleName"
android:layout_width="match_parent"
android:layout_height="@dimen/title_height"
android:text="Terminal Information"
android:textSize="@dimen/title_size"
android:textColor="@color/white"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="true"
android:orientation="horizontal">
<ListView
android:id="@+id/list1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@color/background"
android:dividerHeight="@dimen/interval"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout> 2.List_Items界面布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/terminalInfoLeft"
android:layout_width="match_parent"
android:layout_height="@dimen/list_height"
android:layout_weight="1"
android:textSize="@dimen/text_size1"
android:textColor="@color/black"
android:layout_marginLeft="@dimen/horizontal_interval"
android:gravity="center_vertical" />
<TextView
android:id="@+id/terminalInfoRight"
android:layout_width="match_parent"
android:layout_height="@dimen/list_height"
android:layout_weight="1"
android:gravity="center_vertical|right"
android:layout_marginRight="@dimen/horizontal_interval"
android:textSize="@dimen/text_size2"
android:textColor="@color/terminal_information" />
</LinearLayout>
3.两个ListView显示数据
public final class TerminalInformation {
public static final String[][] DATA={
{"SN:","Serial Number"},
{"esSN:","Extended Seral Number"},
{"PED Ver:","PED Version"},
{"Term Info:","Terminal Information"},
{"APP Ver:","Application Version"}
};
}
4.设置适配器
final ListView listView1= (ListView)findViewById(R.id.list1);
List<Map<String, Object>> listItems=new ArrayList<Map<String,Object>>();
for (int i = 0; i < TerminalInformation.DATA.length; i++) {
Map<String, Object> listItem=new HashMap<String,Object>();
listItem.put("leftdata", TerminalInformation.DATA[i][0]);
listItem.put("rightdata", TerminalInformation.DATA[i][1]);
listItems.add(listItem);
}
SimpleAdapter simpleAdapter = new SimpleAdapter(this,listItems,R.layout.terminal_information,new String[]{"leftdata","rightdata"},new int[]{R.id.terminalInfoLeft,R.id.terminalInfoRight});
listView1.setAdapter(simpleAdapter);
界面显示两个ListView的更多相关文章
- ScrollView中嵌套两个ListView
做的项目中要使用两个ListView在同一个页面上下显示,因为数据源不同,不能通过在Adapter中设置标志位去区分显示,最后只能硬着头皮做一个ScrollView嵌套两个ListView,但按正常情 ...
- Android 一个页面上下两个ListView的页面显示
Android 一个页面上下两个ListView,当上面的ListView过长时,下面的List基本没有了滑动空间,查阅网上资料,解决办法基本是采用ScrollView做页面滑动,notifyData ...
- 仿美团外卖,饿了吗 两个ListView联动,左边点击切换右边,右边滑动切换左边
先上效果图: 实现思路: 1.先说右边标题: 首先,右边的数据源集合中的Javabean中含有三个属性name,type,title,而每个条目中会默认含有一个标题. 如果这是第一个条目,就让标题显示 ...
- Android如何在一个线性布局里完美显示两个listview啊?
复写一个listView ,在你布局文件中使用此view: <ScrollView android:layout_width="fill_parent" android:la ...
- 仿饿了吗点餐界面两个ListView联动效果
这篇文章主要介绍了仿饿了点餐界面2个ListView联动效果的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下 如图是效果图: 是仿饿了的点餐界面 1.点击左侧的ListView,通过在在适 ...
- Android之在Tab更新两个ListView,让一个listview有按下另个一个listview没有的效果
直接上代码,不说了 UpdateListViewItem.zip
- Android学习笔记-构建一个可复用的自定义BaseAdapter
转载自http://www.runoob.com/w3cnote/android-tutorial-customer-baseadapter.html 作者:coder-pig 本节引言: 如题, ...
- Android两级嵌套ListView滑动问题的解决
Android下面两级嵌套ListView会出现滑动失效,解决方案,把两级Listview全换成NoScrollListView,代码如下: public class NoScrollListView ...
- 解析ListView联动的实现--仿饿了么点餐界面
一.博客的由来 大神王丰蛋哥 之前一篇博客仿饿了点餐界面2个ListView联动(http://www.cnblogs.com/wangfengdange/p/5886064.html) 主要实现了2 ...
随机推荐
- Newtonsoft.Json高级用法(转)
手机端应用讲究速度快,体验好.刚好手头上的一个项目服务端接口有性能问题,需要进行优化.在接口多次修改中,实体添加了很多字段用于中间计算或者存储,然后最终用Newtonsoft.Json进行序列化返回数 ...
- Python在Windows下安装第三方库浅谈
在用python编写代码时,往往需要用到第三方库,那么python如何去用第三方库呢,首先我们先来看看是如何安装的,方法可能会很多,但这边只介绍一种,其它请百度或google 比如asyncio,这里 ...
- 神经网络(python源代码)
神经网络的逻辑应该都是熟知的了,在这里想说明一下交叉验证 交叉验证方法: 看图大概就能理解了,大致就是先将数据集分成K份,对这K份中每一份都取不一样的比例数据进行训练和测试.得出K个误差,将这K个误差 ...
- linux之find命令详解
linux之find命令详解 查找文件find ./ -type f查找目录find ./ -type d查找名字为test的文件或目录find ./ -name test查找名字符合正则表达式的文件 ...
- JSON 的应用
使用 JSON 需要的 jar 包:
- 网络-->监控-->单位换算
The metric system In some cases when used to describe data transfer rates bits/bytes are calculated ...
- Java中List,ArrayList、Vector,map,HashTable,HashMap区别用法
Java中List,ArrayList.Vector,map,HashTable,HashMap区别用法 标签: vectorhashmaplistjavaiteratorinteger ArrayL ...
- 我 && symfony3 (路由)
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px "Helvetica Neue"; color: #323333 } p. ...
- SVN 集中式版本控制软件
简介: 目前流行的版本控制软件中,SVN ( 集中式版本控制 ) 算是使用范围更广.且使用时间更早的一款了,现在 git ( 分布式版本控制 ) 更火爆一点. 一.安装svn [root@localh ...
- clr via c# 读书笔记
WOW64 WOW64 (Windows 位应用程序提供了 位的模拟,可以使大多数 位应用程序在无需修改的情况下运行在 Windows 位版本上. com对象 COM:The Component Ob ...