模拟器出来什么也没有
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>
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>
解决方案 »
- 怎么通过手机号码查找联系人员的姓名
- 【高分求讨论】3D控件开发
- Android CTS Holo Testing Fails
- 关于tabhost中进行参数传递的问题
- 这个问题出哪了?大虾们看下
- 怎样通过ContentProvider将SharedPreference内容共享。
- 随便提个问题 音效:破音
- android
- android asynctask doInBackground出现异常
- If you already have a 32-bit JDK installed,define a JAVA_HOME variable in
- android开发天气预报无法通过GPRS访问webservice
- 求助:基于android系统的问卷调查系统的
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);