[android]代码库
public class ListViewAdapter extends BaseAdapter
{
private ArrayList<ImageModel> imgs;
private Context mContext;
private LayoutInflater inflater;
private ImageProcessor mImageProcessor;
TextView itemTitleTxt;
public ListViewAdapter(Context con)
{
super();
mContext = con;
imgs = new ArrayList<ImageModel>();
inflater = LayoutInflater.from(mContext);
prepareImageProcessor(mContext);
}
private void prepareImageProcessor(Context context)
{
final int thumbnailSize = context.getResources().getDimensionPixelSize(R.dimen.image_thumbnail_size);
final int thumbnailRadius = context.getResources().getDimensionPixelSize(R.dimen.image_thumbnail_spacing);
mImageProcessor = new ChainImageProcessor(new ScaleImageProcessor(thumbnailSize, thumbnailSize, ScaleType.FIT_XY), new MaskImageProcessor(thumbnailRadius));
}
public void refersh(ArrayList<ImageModel> list)
{
if (imgs != null && list != null && !list.isEmpty())
{
imgs.clear();
imgs.addAll(list);
// 为了制造更多的数据
imgs.addAll(list);
imgs.addAll(list);
imgs.addAll(list);
imgs.addAll(list);
}
[源代码打包下载]
初级程序员
by: 云代码会员 发表于:2016-10-14 02:47:26 顶(0) | 踩(0) 回复
頂
回复评论