模拟器出来什么也没有
public class ListUser extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.user);
ListView listv = (ListView) findViewById(R.id.ListView01); 

ArrayList<HashMap<String,String>> arrlist = 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>();
map1.put("corpid", "001");
map1.put("corpname", "马祖");
map1.put("corpid", "002");
map1.put("corpname", "周二");
arrlist.add(map1);
arrlist.add(map2);
SimpleAdapter lia = new SimpleAdapter(this,   
                arrlist,   
                R.layout.usercol,   
                new String[] { "cpid", "cpname" },   
                new int[] { R.id.cpid, R.id.cpname });
listv.setAdapter(lia); 

}

}user.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
android:orientation="horizontal"><ListView android:layout_width="fill_parent"    
          android:layout_height="wrap_content"    
          android:id="@+id/ListView01"  
          /> 
</LinearLayout>usercol.xml<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView
        android:id="@+id/cpid"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:singleLine="true"
        />
<TextView
        android:id="@+id/cpname"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
</LinearLayout>

解决方案 »

  1.   

    map1.put("corpid", "001");
    map1.put("corpname", "马祖");
    map1.put("corpid", "002");
    map1.put("corpname", "周二");
    arrlist.add(map1);
    arrlist.add(map2);
    SimpleAdapter lia = new SimpleAdapter(this,   
      arrlist,   
      R.layout.usercol,   
      new String[] { "cpid", "cpname" },   
      new int[] { R.id.cpid, R.id.cpname });
    listv.setAdapter(lia);  修改为
    map1.put("corpid", "001");
    map1.put("corpname", "马祖");
    map2.put("corpid", "002");
    map2.put("corpname", "周二");
    arrlist.add(map1);
    arrlist.add(map2);
    SimpleAdapter lia = new SimpleAdapter(this,   
      arrlist,   
      R.layout.usercol,   
      new String[] { "corpid", "corpname" },   
      new int[] { R.id.cpid, R.id.cpname });
    listv.setAdapter(lia);