ListView 是一个显示可滚动项目列表的视图组。列表项使用适配器自动插入到列表中,该适配器从源(例如数组或数据库查询)中提取内容并将每个项结果转换为放置到列表中的视图。
所以使用ListView 元素在 xml 文件中创建您的列表视图
例如
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
然后在您的主要活动中。使用Adapter 填写您的列表
final ListView listview = (ListView) findViewById(R.id.list);
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
"Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux",
"OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2",
"Android", "iPhone", "WindowsMobile" };
final ArrayList<String> list = new ArrayList<String>();
for (int i = 0; i < values.length; ++i) {
list.add(values[i]);
}
final StableArrayAdapter adapter = new StableArrayAdapter(this,
android.R.layout.simple_list_item_1, list);
listview.setAdapter(adapter);
这会将值数组中的所有项目填充到列表中
更多示例和教程http://developer.android.com/guide/topics/ui/layout/listview.html