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. Huffman编码

    #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstri ...

  2. Android开发学习---使用XmlPullParser解析xml文件

    Android中解析XML的方式主要有三种:sax,dom和pull关于其内容可参考:http://blog.csdn.net/liuhe688/article/details/6415593 本文将 ...

  3. With语句以及@contextmanager的语法解析

    with 语句以及@contextmanager的语法解析   with语句可以通过很简单的方式来替try/finally语句. with语句中EXPR部分必须是一个包含__enter__()和__e ...

  4. flask-admin章节一:使用chartkick画报表

    一般中小型WEB整体来看逻辑比较简单些,一般都是基于数据库的增删改查.不过通过数据库查询到的记录直接展示给用户不是很直观,大家其实蛮期待有一个报表 直接展示他们期待的内容. 这块就涉及到数据的提取和展 ...

  5. call_user_function()方法的使用

    call_user_func ( callback $function [, mixed $parameter [, mixed $... ]] ) 调用第一个参数所提供的用户自定义的函数. 返回值: ...

  6. C1000k 新思路:用户态 TCP/IP 协议栈

    现在的服务器支撑上百万个并发 TCP 连接已经不是新闻(余锋2010年的演讲,ideawu 的 iComet 开源项目,WhatsApp 做到了 2.5M).实现 C1000k 的常规做法是调整内核参 ...

  7. Jquery一般操作归纳

    一.DOM操作分类    1.DOM Core  getElement(s)获得元素        2.HTML-DOM  document.对象/操作标签的属性        3.CSS-DOM   ...

  8. prism4 StockTrader RI 项目分析一些体会

    StockTrader RI 代码分析也有一段时间了 刚从codeplex获取到源代码的时候,看得一头雾水,不知所云(因为之前没做过wpf的项目,看文档也静不下那心来看) 后来就想了个笨办法,模拟项目 ...

  9. Java使用Scanner接收中文并输出时出现乱码

    Java中使用Scanner接收输入的中文并输出时会出现乱码现象,怎么解决此问题呢? 1.方法一 在声明Scanner时添加对应的编码格式就可以了,如下所示: Scanner sc = new Sca ...

  10. k-sum问题

    给定一个数组,里面的是任意整数,可能有重复,再给定一个目标T,从数组中找出所有和为T的K个数,要求结果中没有重复. Note: Elements in a quadruplet (a,b,c,d) m ...