Android开发学习笔记:浅谈GridView(8)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-06 08:44 点击:次
for (int i = 0; i < images.length; i++)
{
Picture picture = new Picture(titles[i], images[i]);
pictures.add(picture);
}
}
@Override
public int getCount()
{
if (null != pictures)
{
return pictures.size();
} else
{
return 0;
}
}
@Override
public Object getItem(int position)
{
return pictures.get(position);
}
@Override
public long getItemId(int position)
{
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder viewHolder;
if (convertView == null)
{
convertView = inflater.inflate(R.layout.picture_item, null);
viewHolder = new ViewHolder();
viewHolder.title = (TextView) convertView.findViewById(R.id.title);
viewHolder.image = (ImageView) convertView.findViewById(R.id.image);
convertView.setTag(viewHolder);
} else
{
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.title.setText(pictures.get(position).getTitle());
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>