listView 多值显示
16lz
2021-01-23
<ListView android:id="@+id/SCHEDULE" android:layout_width="wrap_content" android:layout_height="wrap_content"></ListView>
<?xml version="1.0" encoding="utf-8"?><!-- row.xml --><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:paddingTop="4dip" android:paddingBottom="6dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/TRAIN_CELL" android:layout_width="50dip" android:layout_height="wrap_content"/> <TextView android:id="@+id/FROM_CELL" android:layout_width="70dip" android:layout_height="wrap_content" android:layout_weight="1"/> <TextView android:id="@+id/TO_CELL" android:layout_width="60dip" android:layout_height="wrap_content" android:layout_weight="1"/></LinearLayout>
ListView list = (ListView) findViewById(R.id.SCHEDULE);ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();HashMap<String, String> map = new HashMap<String, String>();map.put("train", "101");map.put("from", "6:30 AM");map.put("to", "7:40 AM");mylist.add(map);map = new HashMap<String, String>();map.put("train", "103(x)");map.put("from", "6:35 AM");map.put("to", "7:45 AM");mylist.add(map);// ...mSchedule = new SimpleAdapter(this, mylist, R.layout.row, new String[] {"train", "from", "to"}, new int[] {R.id.TRAIN_CELL, R.id.FROM_CELL, R.id.TO_CELL});list.setAdapter(mSchedule);
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer