资 源 简 介
最简单的Android ListView用法示例,这估计是大家用得最多的列表控件,几乎90%的Android APP中都可见到Listview的身影哦,本示例只是ListView组件用法的入门例子,比较简单,运行效果如图所示,相关代码如下:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String[] str = {"aaaa","bbbbbb","cccccc","vvvvvvvv","ddd","ee"};
ListView listView = (ListView)findViewById(R.id.lsitview);
ArrayAdapter arrAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_multiple_choice,str);
listView.setAdapter(arrAdapter);