首先制作ListView页面。
活动页与布局对应;
<ListView
android:id="@+id/lv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
制作item页
这个页面用于填充布局;
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@mipmap/elv"
android:textSize="20sp" />
制作Bean用于储存数据;
package com.example.listview2;
public class Bean {
String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
在主活动制造添加数据
private List&l