android用户界面-组件Widget-列表视图ListView
ListView是比较常用的控件 程序效果是实现一个ListView,ListView里面有标题,内容和图片,并加入点击和长按响应。 列表的显示需要三个元素: 1.ListVeiw 用来展示列表的View。 2.适配器 用来把数据映射到ListView上的中介。 3.数据 具体的将被映射的字符串,图片,或者基本组件。 根据列表的适配器类型,列表分为三种,ArrayAdapter,SimpleAdapter和SimpleCursorAdapter SimpleAdapter的例子如下: 首先在xml里面定义一个ListView 1.<?xmlversion="1.0"encoding="utf-8"?> 2.<LinearLayout 3.android:id="@+id/LinearLayout01" 4.android:layout_width="fill_parent" 5.android:layout_height="fill_parent" 6.xmlns:android="http://schemas.android.com/apk/res/a...