ExpandableList列表的简单应用
package com.test;
//Download by http://ww.codefans.net
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.test.R.string;
import android.app.ExpandableListActivity;
import android.os.Bundle;
import android.widget.ExpandableListAdapter;
import android.widget.SimpleExpandableListAdapter;
public class expandableList extends ExpandableListActivity {
private static final String SHELF = "SHELF";
private static final String BOOK = "BOOK";
private ExpandableListAdapter mAdapter;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
for (int i = 1; i < 5; i++) {
Map<String, String> curGroupMap = new HashMap<String, String>();
groupData.add(curGroupMap);
curGroupMap.put(SHELF, "Bookshelf-" + i);
List<Map<String, String>> children = new ArrayList<Map<String, String>>();
for (int j = 1; j < 4; j++) {
Map<String, String> curChildMap = new HashMap<String, String>();
children.add(curChildMap);
curChildMap.put(SHELF, "Book- " + j);
}
childData.add(children);
}
// Set up our adapter
mAdapter = new SimpleExpandableListAdapter(
this,
groupData,
android.R.layout.simple_expandable_list_item_1,
new String[] { SHELF, BOOK},
new int[] { android.R.id.text1, android.R.id.text2 },
childData,
android.R.layout.simple_expandable_list_item_2,
new String[] { SHELF, BOOK},
new int[] { android.R.id.text1, android.R.id.text2 }
);
setListAdapter(mAdapter);
}
}
ExpandableList列表的简单应用的更多相关文章
- Python基础-使用range创建数字列表以及简单的统计计算和列表解析
1.使用函数 range() numbers = list(range[1,6]) print (numbers) 结果: [1,2,3,4,5] 使用range函数,还可以指定步长,例如,打印1~1 ...
- 零基础python之列表的简单介绍
你点击关注,就分你小鱼干 一.概念:列表,由一系列按特定顺序排列的元素组成. 在 python 中,用 [ ] 方括号来表示列表,并用逗号来分割其中的元素. 二.访问列表因素 列表是有序集合,如要访问 ...
- devi into python 笔记(一)字典 列表的简单操作
模块: python中模块是很重要的概念,在模块中加入 if __name__ == "__main__": pass 会使模块应用起来更加灵活,避免出错. =========== ...
- WP8.1开发中ListView控件加载图列表的简单使用(1)
我也是刚接触WP编程没几个月,就是在这段时间一直闲着没事,然后又比较喜欢WP这款系统,就学习了WP这方面的开发言语,自学是很困难的,掌握这方面的资料不多,很初级,就是自己在网上找资料学习过程中,看到别 ...
- ListView列表的简单案例
在android开发中ListView它以列表的形式展示具体内容,并且能够根据数据的长度自适应显示.抽空把对ListView的使用做了整理,并写了个小例子 列表示例图: BaseActivity pa ...
- Python初学者第五天 列表及简单操作
5day 数据类型:列表 1.创建列表 user = ['aa','14',1,10,'aa',1,2,3,3,5,9] n = [] list() m = list() 2.查询 a.按索引查询 b ...
- <每日一题>题目13:列表的简单问题
''' 分析: python赋值是通过指针来进行的. 很显然第一.三.四次调用都指向同一个列表,并未完成清空, 第二次调用只是指向了另一个列表,也未完成清空,很显然结果是累计的 结果: [0, 1] ...
- java中使用redis --- List列表的简单应用
1.Dos中启动server端 2.idea中启动client端 public class RedisTest01 { public static void main(String[] args){ ...
- python中列表的简单用法
1.定义list >>> li = ["a", "b", "mpilgrim", "z", " ...
随机推荐
- N - Optimal Milking - POJ 2112(二分图多重匹配+Floyd+二分搜索)
题意:有K太挤奶机,C头奶牛,每个挤奶机每天只能为M头奶牛服务,下面给的K+C的矩阵,是形容相互之间的距离,求出来走最远的那头奶牛要走多远 分析:应该先使用floyd求出来点之间的最短路??(不晓得给 ...
- max key length is 1000 bytes
ALTER TABLE ad_keyword_brand ADD CONSTRAINT w1 UNIQUE (keyword,adasin,brand,page_position,country,ad ...
- UVA 140 (13.07.29)
Bandwidth Given a graph (V,E) where V is a set of nodes and E is a set of arcsin VxV, and anorderi ...
- 2015 GOOGLE I/O大会看点总结:新的开发工具及云端测试工具
http://ask.android-studio.org/?/article/48 尽管凌晨开始的主题演讲略显晦涩并继承了谷歌一贯的东一句西一句想起啥说啥的混乱风格,但期待用技术改变世界的技 ...
- Android BaseAdapter ListView (SD卡中文件目录显示出来)
首先搭建activity_main.xml布局 搭建ListView中显示的布局 创建适配器 将File数据和UI适配 MainActivity中将ListView设置适配器,并设置监听 //获取SD ...
- Android 用ping的方法判断当前网络是否可用
判断网络的情况中,有个比较麻烦的情况就是连上了某个网络,但是那个网络无法上网 ,,, = = 想到了用ping指令来判断,经测试,可行~ ~ ~ private static final boolea ...
- ListView 水平滑动 水平和竖直滑动
效果 Activity public class MainActivity extends Activity { @Override protected void onCreate(B ...
- HTML5和CSS3实例教程[总结一]
关于onclick的行为与内容分离 通过链接触发弹出窗口方式 (不推荐使用此方法!!!) <a href='#' onclcik = "window.open('holiday_pay ...
- linux的sudo apt-get install 和dpkg -i <package.deb>命令
ubuntu统一的安装软件命令 sudo apt-get install ** sudo dpkg -i <package.deb>
- ajax分页实现,jquery.pagination.js
1.前台使用ajax无刷新分页,主要需要生成分页的工具条,这里使用的是jquery.pagination.js 插件参数可以参考----张龙豪-jquery.pagination.js分页 下面贴出代 ...