您的位置:首页 > 其它

修改SimpleAdapter里的数据

2015-01-30 17:33 106 查看
修改SimpleAdapter里的数据,在如下第二个for语句里:

ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
for(int i = 0; i < cursor.getCount(); i++,cursor.moveToNext()){
HashMap<String, String> hp = new HashMap<String, String>();
hp.put("name", cursor.getString(1));
hp.put("num", cursor.getString(2));
list.add(hp);
}
SimpleAdapter simpleAdapter = new SimpleAdapter(this, list,
R.layout.item_list_fragment4, new String[] { "name", "num" },
new int[] { R.id.tv_reference_num1, R.id.tvNum });
listview.setAdapter(simpleAdapter);
for(int i = 0; i < list.size(); i++){
@SuppressWarnings("unchecked")
HashMap<String, String> hp = (HashMap<String, String>) simpleAdapter.getItem(i);
if(hp.get("num").equals("0")){
hp.put("num", "");
}
}


但是要修改字体大小,不能直接初始化SimpleAdapter对象,可以自定义一个类。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐