关于Android开发中列表的使用问题,大神请进来给小白解答下,谢谢啦
publicclassTipextendsActivity{privateList<Map<String,Object>>sList=newArrayList<Map<S...
public class Tip extends Activity {
private List<Map<String, Object>> sList =
new ArrayList<Map<String,Object>>();
private String littleTips[] = {
"啦啦啦啦啊",
"哈哈哈",
"嘿嘿hi额hi额"
};
private double rating[] = {
0,
0.5,
1.0
};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tip);
for (int i = 0; i < littleTips.length; i++) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("pic", R.drawable.health);
map.put("tip", littleTips[i]);
map.put("rating", rating[i]);
sList.add(map);
}
ListAdapter listAdapter = new SimpleAdapter(this,sList,R.layout.table,
new String []{"pic","tip","rating"},
new int[]{R.id.imageView1,R.id.littleTips,R.id.ratingBar1}
);
((ListView)findViewById(R.id.tips)).setAdapter(listAdapter);
}
}
为何在程序运行中没有列表这一页,显示为空白,是没有加载上吗?请大神解答~谢谢啦!!!! 展开
private List<Map<String, Object>> sList =
new ArrayList<Map<String,Object>>();
private String littleTips[] = {
"啦啦啦啦啊",
"哈哈哈",
"嘿嘿hi额hi额"
};
private double rating[] = {
0,
0.5,
1.0
};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tip);
for (int i = 0; i < littleTips.length; i++) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("pic", R.drawable.health);
map.put("tip", littleTips[i]);
map.put("rating", rating[i]);
sList.add(map);
}
ListAdapter listAdapter = new SimpleAdapter(this,sList,R.layout.table,
new String []{"pic","tip","rating"},
new int[]{R.id.imageView1,R.id.littleTips,R.id.ratingBar1}
);
((ListView)findViewById(R.id.tips)).setAdapter(listAdapter);
}
}
为何在程序运行中没有列表这一页,显示为空白,是没有加载上吗?请大神解答~谢谢啦!!!! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询