class SampleGrIDVIEwAdapter extends BaseAdapter { private final Context context; private final List<String> urls = new ArrayList<String>(); public SampleGrIDVIEwAdapter(Context context) { this.context = context; // Ensure we get a different ordering of images on each run. Collections.addAll(urls,Data.URLS); Collections.shuffle(urls); // Triple up the List. ArrayList<String> copy = new ArrayList<String>(urls); urls.addAll(copy); urls.addAll(copy); } @OverrIDe public VIEw getVIEw(int position,VIEw convertVIEw,VIEwGroup parent) { SquaredImageVIEw vIEw = (SquaredImageVIEw) convertVIEw; if (vIEw == null) { vIEw = new SquaredImageVIEw(context); vIEw.setScaleType(CENTER_CROP); } // Get the image URL for the current position. String url = getItem(position); // Trigger the download of the URL asynchronously into the image vIEw. Picasso.with(context) // .load(url) // .placeholder(R.drawable.placeholder) // .error(R.drawable.error) // .fit() // .tag(context) // .into(vIEw); return vIEw; } @OverrIDe public int getCount() { return urls.size(); } @OverrIDe public String getItem(int position) { return urls.get(position); } @OverrIDe public long getItemID(int position) { return position; }}总结
以上是内存溢出为你收集整理的android – 毕加索图书馆和GridView图像全部内容,希望文章能够帮你解决android – 毕加索图书馆和GridView图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)