simpleAdapter 简单实用方法
来源:互联网 发布:中国人的审美 知乎 编辑:程序博客网 时间:2024/04/29 22:47
private int [] name = {R.string.kaoqin,R.string.chuangyikejian,R.string.lianxiyuanzhang,R.string.kecheng,
R.string.shipu,R.string.xueshengzuopin,R.string.huodong,R.string.studentinformation,R.string.more};
private int[] imageids = { R.mipmap.kaoqin,R.mipmap.chuangyikejian,R.mipmap.lianxiyuanzhang,R.mipmap.kecheng,
R.mipmap.shipu,R.mipmap.baobeizuopin,R.mipmap.huodong,R.mipmap.teacherinformation,R.mipmap.more };
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for (int i = 0; i < name.length; i++) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("image", imageids[i]);
map.put("name",getString( name[i]));
list.add(map);
}
SimpleAdapter simpleAdapter = new SimpleAdapter(getActivity(), //上下文
list,//list集合,里面放的是map,键值分别是名字和数据
R.layout.item_gridview,//item布局文件
new String[] {"image","name"},//所有的键,和下面的控件对应
new int[] {R.id.ItemImage,R.id.ItemText});//item里面控件的id
mGridview.setAdapter(simpleAdapter);//适配器
R.string.shipu,R.string.xueshengzuopin,R.string.huodong,R.string.studentinformation,R.string.more};
private int[] imageids = { R.mipmap.kaoqin,R.mipmap.chuangyikejian,R.mipmap.lianxiyuanzhang,R.mipmap.kecheng,
R.mipmap.shipu,R.mipmap.baobeizuopin,R.mipmap.huodong,R.mipmap.teacherinformation,R.mipmap.more };
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for (int i = 0; i < name.length; i++) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("image", imageids[i]);
map.put("name",getString( name[i]));
list.add(map);
}
SimpleAdapter simpleAdapter = new SimpleAdapter(getActivity(), //上下文
list,//list集合,里面放的是map,键值分别是名字和数据
R.layout.item_gridview,//item布局文件
new String[] {"image","name"},//所有的键,和下面的控件对应
new int[] {R.id.ItemImage,R.id.ItemText});//item里面控件的id
mGridview.setAdapter(simpleAdapter);//适配器
0 0
- simpleAdapter 简单实用方法
- simpleAdapter的简单实用
- LayoutAnimationContrller 以及Simpleadapter的简单实用
- MemCache简单实用方法
- EditText方法简单实用
- Swiper的简单实用方法
- Linux telnet简单实用方法
- Realm 入门 简单实用方法
- Java简单实用方法一
- Java 简单实用方法二
- iOS简单实用方法封装
- SimpleAdapter的简单介绍
- SimpleAdapter简单适配器
- SimpleAdapter的简单使用
- SimpleAdapter使用简单介绍
- SimpleAdapter简单适配器
- SimpleAdapter.ViewBinder方法说明
- SimpleAdapter.ViewBinder方法说明
- 工程如何添加Alamofire
- 继承性 inherited
- 升级cmake
- 正向代理和反向代理的区别
- java基础18-io
- simpleAdapter 简单实用方法
- 解决QNetworkAccessManager实现ftp功能后,不能上传大于1G文件的问题
- 使用 FileSystem JAVA API 对 HDFS 进行读、写、删除等操作
- Java实现简单二叉树
- android ScrollView 嵌套RecyclerView 快速滑动粘黏问题
- 数据结构预备知识(一)
- java int与integer的区别
- 什么是 epmd
- 基于迅为4412精英版连接SIM7100C模块Android下调试——RIL库分析(一)