listview是android应用相当广的一个控件,系统为其自定了三种属性,但是这些属性在日常商业化的开户应用中,基本上不会用到,用到的基本都会是自定义适配器,以下就一个简单的实例介绍一下如何用listview实现适配器
1、定义适配器 activity, 假设命名为 item1.xml 文件代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/img"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@mipmap/ic_launcher"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" ></