您的位置:首页 > 移动开发 > Android开发

android ListView和ProgressBar(进度条控件)的使用方法

2013-11-18 15:28 1416 查看

    @Override
    public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);

   //建立一个ArrayList,ArrayList里面放的是Hash表
   ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String,String>>();
   HashMap<String, String>map1 = new HashMap<String, String>();
   HashMap<String, String>map2 = new HashMap<String, String>();
   HashMap<String, String>map3 = new HashMap<String, String>();
   //给Hash表中填入键值对
   map1.put("user_name", "小红");
   map1.put("user_birthday", "2012_07_30");
   map2.put("user_name", "小明");
   map2.put("user_birthday", "2012_07_31");
   map3.put("user_name", "小冬");
   map3.put("user_birthday", "2012_08_01");
   list.add(map1);
   list.add(map2);
   list.add(map3);
   //在该activity中创建一个简单的适配器
   SimpleAdapter listAdapter = new SimpleAdapter(this, list,
   R.layout.activity_user, new String[]{
   "user_name", "user_birthday"}, new int[]
  {R.id.user_name, R.id.user_birthday});
   //载入简单适配器
   setListAdapter(listAdapter);
    }

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息