- Caused by: java.lang.IllegalStat
- Caused by: java.lang.IllegalStat
- Caused by: java.lang.IllegalStat
- Caused by: java.lang.IllegalStat
- Caused by: java.lang.IllegalStat
- Caused by: java.lang.IllegalStat
- Caused by: java.lang.IllegalStat
- Tablayout报错Error inflating class
- Android 常见的Crash的产生和处理
- 解决android中出现的“android.view.Windo
Caused by: java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor
Bitmap bmp =BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); Paint paint =new Paint();
paint.setColor(Color.BLACK);
String str ="123";
Canvas canvas =new Canvas(bmp); //此句报错
canvas.drawText(str, 0,0, paint);
不允许直接修改res里面的图片,只要在后面加上.copy(Bitmap.Config.ARGB_8888, true);
修改后:
Bitmap originalBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.a).copy(Bitmap.Config.ARGB_8888, true);
网友评论