我们一般需要自定义adapter 这里就需要继承BaseAdapter
adapter在MVC开发模式中,是控制层
baseAdapter 继承这个方法必须重写 四个方法
1. getcont 方法 这个是返回总记录数
2. object getItem 方法 这个方法是返回选项内容
3 .getItemId 方法 这个方法是返回选项内容ID
4.getView 方法 这个方法显示一行行的记录(最重要的方法)
(一) 首先编写xml布局文件
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ListView
android:id="@+id/listview"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
</RelativeLayout>
ziyuan.xml
<?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="horizontal" >
<ImageView
android:id="@+id/Image"
androi