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的更多相关文章

  1. ScrollView中嵌套两个ListView

    做的项目中要使用两个ListView在同一个页面上下显示,因为数据源不同,不能通过在Adapter中设置标志位去区分显示,最后只能硬着头皮做一个ScrollView嵌套两个ListView,但按正常情 ...

  2. Android 一个页面上下两个ListView的页面显示

    Android 一个页面上下两个ListView,当上面的ListView过长时,下面的List基本没有了滑动空间,查阅网上资料,解决办法基本是采用ScrollView做页面滑动,notifyData ...

  3. 仿美团外卖,饿了吗 两个ListView联动,左边点击切换右边,右边滑动切换左边

    先上效果图: 实现思路: 1.先说右边标题: 首先,右边的数据源集合中的Javabean中含有三个属性name,type,title,而每个条目中会默认含有一个标题. 如果这是第一个条目,就让标题显示 ...

  4. Android如何在一个线性布局里完美显示两个listview啊?

    复写一个listView ,在你布局文件中使用此view: <ScrollView android:layout_width="fill_parent" android:la ...

  5. 仿饿了吗点餐界面两个ListView联动效果

    这篇文章主要介绍了仿饿了点餐界面2个ListView联动效果的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下 如图是效果图: 是仿饿了的点餐界面 1.点击左侧的ListView,通过在在适 ...

  6. Android之在Tab更新两个ListView,让一个listview有按下另个一个listview没有的效果

    直接上代码,不说了 UpdateListViewItem.zip

  7. Android学习笔记-构建一个可复用的自定义BaseAdapter

    转载自http://www.runoob.com/w3cnote/android-tutorial-customer-baseadapter.html   作者:coder-pig 本节引言: 如题, ...

  8. Android两级嵌套ListView滑动问题的解决

    Android下面两级嵌套ListView会出现滑动失效,解决方案,把两级Listview全换成NoScrollListView,代码如下: public class NoScrollListView ...

  9. 解析ListView联动的实现--仿饿了么点餐界面

    一.博客的由来 大神王丰蛋哥 之前一篇博客仿饿了点餐界面2个ListView联动(http://www.cnblogs.com/wangfengdange/p/5886064.html) 主要实现了2 ...

随机推荐

  1. Xcode8不能使用快捷键“command+/”注释代码的解决方法

    sudo /usr/libexec/xpccachectl 打开终端,输入该命令(如果电脑有密码的话,会有提示让输入密码) 接下来重启电脑. command + option + / 还可以多行注释

  2. ios pod库更新到1.0或1.0.1之正确修改podfile文件

    今天看到cocopods都更新到1.0.1了,之前什么时候更新到的1.0都没发现,刚刚更新一下之后,立马出现了一大堆的错误. 如果没有更新的话,建议不要更新!!!书写麻烦了! 现在记录如何一步一步去除 ...

  3. VueJS取得URL参数

    vuejs取得URL中参数的值 地址:http://localhost:3333/#/index?id=001 结果:001 console.log(this.$route.query.id)

  4. 技术英文单词贴--N

    N normally 正常地,一般地

  5. PHP读取Excel数据写入数据库(包含图片和文字)

    public function test(){ $exts = 'xlsx'; //导入PHPExcel类库,因为PHPExcel没有用命名空间,只能inport导入 import("Org ...

  6. [刘阳Java]_MyBatis_动态SQL标签用法_第7讲

    1.MyBatis的动态SQL是基于OGNL表达式的,它可以帮助我们方便的在SQL语句中实现某些逻辑. 2.MyBatis中用于实现动态SQL的元素主要有 if choose(when,otherwi ...

  7. [goa]golang微服务框架学习(三)-- 使用swagger-ui展示API

    既然goa框架自动生成啦swagger-json文件,那么如何用swagger-ui展示出来呢? 这里分三步: 1.下载swagger-ui的web代码 2.添加swagger.json 和 swag ...

  8. Computer Vision 学习 -- 图像存储格式

    本文把自己理解的图像存储格式总结一下. 计算机中的数据,都是二进制的,所以图片也不例外. 这是opencv文档的描述,具体在代码里面,使用矩阵来进行存储. 类似下图是(BGR格式): 图片的最小单位是 ...

  9. Loaders

    Android3.0之后引入了加载器,支持轻松在Activity和Fragment中异步加载数据.加载器具有以下特点: 1.可用于任何Activity和Fragment 2.支持异步加载数据 3.监控 ...

  10. Select语句也会引起死锁

    项目上线,准备验收前出现了一个严重的问题:很多select语句作为死锁的牺牲,大部分报表无法打开.这个问题影响范围很大所有的报表都无法访问,而我们的报表是放在电视上面轮播的,电视放在工厂里面,所以出现 ...