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. C#多线程实现方法

    C#中实现线程应用开发的类都包含在了System.Threading命名空间中,比较常用的是Thread,ThreadPool类 Thread类构造函数作用是创建线程,有两个重载版本,一个带参数,一个 ...

  2. div赋值,取值和input赋值,取值

    一.div取值 <div id="txtXiaofei" class="txt-panel">你好</div> 获取div的值$(&qu ...

  3. 使用NSScanner,将十六进制字符串转十进制

    例子:  NSString * numStr = [@"0x110" substringFromIndex:2]; unsigned long long result = 0; N ...

  4. js 事件绑定

    事件绑定的方式 1.  DOM  元素行内绑定 <div onclick="alert(1)"></div>   2. js on+eventType do ...

  5. selenium2(WebDriver)环境搭建

    1.安装jdk并配置环境变量: jdk安装jdk下载地址: http://www.oracle.com/technetwork/java/javase/downloads/index.html环境变量 ...

  6. mysql 用命令操作

    本篇文章来源于http://c.biancheng.net/cpp/html/1441.html mysql:连接数据库 mysql命令用户连接数据库. mysql命令格式: mysql -h主机地址 ...

  7. hdu 1069 (DP) Monkey and Banana

    题目:这里 题意: Description 一组研究人员正在设计一项实验,以测试猴子的智商.他们将挂香蕉在建筑物的屋顶,同时,提供一些砖块给这些猴子.如果猴子足够聪明,它应当能够通过合理的放置一些砖块 ...

  8. Spring SpringMVC和Mybatis整合

    1.引入所要的jar包 2.创建Mybatis的sqlMapConfig.xml配置文件,该文件中可以配置mybaits的相关参数,数据源不在这里配置. <?xml version=" ...

  9. Python.with.context-manager

    Context Manager 1. Context Manager简介 "Context managers are a way of allocating and releasing so ...

  10. Java多线程简析

    一.线程的状态: 线程共有下面4种状态: 1.新建状态(New): 新创建了一个线程对象,当你用new创建一个线程时,该线程尚未运行. 2.就绪状态(Runnable): 线程对象创建后,其他线程调用 ...