ITEEDU

例一ArrayAdapter +ListAvtivit

创建Test 继承ListActivity 这里我们传入一个string数组

public class ListTest extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] sw = new String[100];
for (int i = 0; i < 100; i++) {
sw[i] = "listtest_" + i;
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this,
android.R.layout.simple_list_item_1
,sw); //使用系统已经实现好的xml文件simple_list_item_1
setListAdapter(adapter);
}
}