<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="134dp"
android:layout_alignParentTop="true"
android:layout_marginTop="92dp"
android:layout_toEndOf="@+id/itemText"
android:layout_toRightOf="@+id/itemText"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/itemImage"
android:layout_width="109dp"
android:layout_height="134dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/itemText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="108dp"
android:layout_marginStart="108dp"
android:layout_weight="1"
android:gravity="center" />
</RelativeLayout>
最后:是数据类,每个数据代表了一张图片(R.drawable.pictureName的数据ID:int型)和文本显示的数据(String型)
//自定义数据类
public class People {
private String Data; //TextView里存放的文本数据
private int ImageId; //ImageView里存放的图片数据(在R.drawable.里的用int形式)
People(String Data, int ImageId){
this.Data=Data;
this.ImageId=ImageId;
}
public String getData() {
return Data;
}
public void setData(String data) {
Data = data;
}
public int getImageId(http://www.amjmh.com) {
return ImageId;
}
public void setImageId(int imageId) {
ImageId = imageId;
}
public String toString(){
return Data+String.valueOf( ImageId );
}
}