我有一个固定RecycleViewer(GridLayoutManager)
的0,2,5,7 个位置Custom images (relativeLayout converted to bitmap)
我想跳过这0,2,5,7 个位置,因为它们已经有了Custom images
,我想用服务器图像填充其余位置
在 onBindViewHolder 里面
if (position == 0) {
ProfilePhotosViewHolder.relativeBucket.setVisibility(View.VISIBLE);
ProfilePhotosViewHolder.relativeBucket.setDrawingCacheEnabled(true);
ProfilePhotosViewHolder.relativeBucket.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
ProfilePhotosViewHolder.relativeBucket.layout(0, 0, ProfilePhotosViewHolder.relativeBucket.getMeasuredWidth(), ProfilePhotosViewHolder.relativeBucket.getMeasuredHeight());
ProfilePhotosViewHolder.relativeBucket.buildDrawingCache(true);
Bitmap b = Bitmap.createBitmap(ProfilePhotosViewHolder.relativeBucket.getDrawingCache());
ProfilePhotosViewHolder.relativeBucket.setDrawingCacheEnabled(false);
ProfilePhotosViewHolder.imgProfilePhotos.setImageBitmap(b);
}
if (position == 2) {
...
}
if (position == 5) {
...
}
if (position == 7) {
...
}
if (position!=0 || position!= 2 || position!=5 || position!=7){
ImageLoader imageLoader = AppController.getInstance().getImageLoader();
ProfilePhotosViewHolder.imgProfilePhotos.setImageUrl(model.Images, imageLoader);
ProfilePhotosViewHolder.imgProfilePhotos.setDefaultImageResId(R.drawable.im_profile_monuments);
ProfilePhotosViewHolder.imgProfilePhotos.setErrorImageResId(R.drawable.bt_profile_addphoto);
}
但是服务器图像不会跳过0,2,5,7位置,它也会显示(技术上在我的自定义图像后面)