Android开发学习笔记:浅谈GridView(9)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-06 08:44 点击:次
viewHolder.image.setImageResource(pictures.get(position).getImageId());
return convertView;
}
}
class ViewHolder
{
public TextView title;
public ImageView image;
}
class Picture
{
private String title;
private int imageId;
public Picture()
{
super();
}
public Picture(String title, int imageId)
{
super();
this.title = title;
this.imageId = imageId;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public int getImageId()
{
return imageId;
}
public void setImageId(int imageId)
{
this.imageId = imageId;
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
picture_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>