以显示注册信息为例:
一、创建带有ListView的Activity要继承ListActivity
this.setContentView(R.layout.user);
二、ListActivity的布局文件user.xml
andoid:scrollbars="vertical" android:drawSelectorOnTop="false"> 三、使用intent获得用户保存的信息 Intent intent = getIntent(); String username = intent.getStringExtra("username"); HashMap .. map1.put("user_key","姓名"); map 1.put("user_value",username); ... //对数组进行拆分 String hob = ""; for(String h:hobby){ hob += h=" "; } List list.add(map1); ... 五、设置适配器 设置list.xml布局文件; 指定list控件 SimpleAdapter adapter = new SimpleAdapter(this,list,R.layout.list, new String[]{"user_key","user_value"}, new int[]{R.id.userkey,R.id.uservlaue} ); setListAdapter(adapter);
四 、创建要显示的list内容