如何在一个活动中添加2个ListAdapter
以及更多内容?例如:
答案 0 :(得分:1)
对于每个列表视图,我会这样做
final String1[] menu1 = {"menu","menu","menu"};
final String2[] menu2 = {"menu","menu","menu"};
final String3[] menu3 = {"menu","menu","menu"};
ListView lv1 = (ListView) findViewById(R.id.listView1);
ListView lv2 = (ListView) findViewById(R.id.listView2);
ListView lv3 = (ListView) findViewById(R.id.listView3);
lv1.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu1));
lv2.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu1));
lv3.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu1));