【发布时间】:2015-06-18 13:08:32
【问题描述】:
当我从视图的 DrawingCache 中获取位图时,我没有收到任何错误,但我也没有看到有效的位图。我究竟做错了什么?
我用来生成位图的代码:
SharePhotoView sharePhotoView = SharePhotoView_.build(this);
sharePhotoView.bind(mCatch);
sharePhotoView.setDrawingCacheEnabled(true);
sharePhotoView.buildDrawingCache();
Bitmap bitmap = sharePhotoView.getDrawingCache();
catchImage.setImageBitmap(bitmap);
我用来制作视图的代码:
@EViewGroup(R.layout.share_photo)
public class SharePhotoView extends LinearLayout{
@ViewById
ImageView catchImage;
public SharePhotoView(Context context) {
super(context);
}
public void bind(Catch catchItem) {
Bitmap bitmap = BitmapFactory.decodeFile(catchItem.getImage().getPath());
catchImage.setImageBitmap(bitmap);
}
}
【问题讨论】:
标签: android bitmap android-annotations