使用BaseAdapter 来创建图文实现更灵活的列表
使用
BaseAdapter
来实现我们自己定义的布局,并且可以对其内部进行操作。
使用
BaseAdapter
实现图文共现的列表步骤如下:
在主布局中
xml
文件中声明一个
ListView
,承装需要加载的内容:
<?
xml
version
=
“1.0”
encoding
=
“utf-8”
?>
<
LinearLayout
xmlns:android
=
“http://schemas.android.com/apk/res/android”
android:layout_width
=
“match_parent”
android:layout_height
=
“match_parent”
android:orientation
=
“vertical”
>
<
ListView
android:id
=
“@+id/listView5”
android:layout_width
=
“match_parent”
android:layout_height
=
“wrap_content”
>
</
ListView
>
</
LinearLayout
>
二:定义列表项模板 &#x