Immutable bitmap passed to Canvas constructor

来源:互联网 发布:xp安装软件需要密码 编辑:程序博客网 时间:2024/06/06 15:22
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bg)  Canvas canvas = new Canvas(bitmap);

当在canvas里调用的时候会出错:

Immutable bitmap passed to Canvas constructor

要改成这样

     Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bg)     .copy(Bitmap.Config.ARGB_8888, true);  Canvas canvas = new Canvas(bitmap);
0 0