Android未知位图配置

时间:2015-02-05 09:14:39

标签: android

我有错误。

E/AndroidRuntime(13921): java.lang.IllegalArgumentException: unknown bitmap configuration
E/AndroidRuntime(13921):    at android.graphics.Bitmap.nativeCreate(Native Method)
E/AndroidRuntime(13921):    at android.graphics.Bitmap.createBitmap(Bitmap.java:939)
E/AndroidRuntime(13921):    at android.graphics.Bitmap.createBitmap(Bitmap.java:912)
E/AndroidRuntime(13921):    at android.graphics.Bitmap.createBitmap(Bitmap.java:879)
E/AndroidRuntime(13921):    at com.ScalaView.onMeasure(ScalaView.java:46)

代码:

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int w = widthMeasureSpec, h = heightMeasureSpec;

    Bitmap.Config conf = Bitmap.Config.RGB_565; // see other conf types
    Bitmap bmp = Bitmap.createBitmap(w, h, conf); // this creates a MUTABLE bitmap
    Canvas canvas = new Canvas(bmp);
    currentHeight = canvas.getHeight();
    drawLines(canvas);
    setImageBitmap(bmp);
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

我只是创建一个空白位图。为什么我收到这个错误?

0 个答案:

没有答案