以下代码用于从另一个位图bmpSrc:
创建旋转和缩放的位图 final int srcWidth = bmpSrc.getWidth();
final int srcHeight = bmpSrc.getHeight();
final float sx = (float)reqWidth / (float)srcWidth;
final float sy = (float)reqHeight / (float)srcHeight;
Matrix m = new Matrix();
m.setScale(sx, sy);
final float px = (float) srcWidth / 2;
final float py = (float) srcHeight / 2;
m.setRotate(270, px, py);
bmpFillScreen = Bitmap.createBitmap(bmpSrc, 0, 0, reqHeight, reqWidth, m, true);
但是在某些设备上(特别是10英寸平板电脑),它会抛出这个例外:
java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
at android.graphics.Bitmap.createBitmap(Bitmap.java:554)
我该怎么做才能解决这个问题?