createBitmap — java.lang.IllegalArgumentException: x must be < bitmap.width()

前端 未结 4 1831
天涯浪人
天涯浪人 2020-12-09 11:50

I am getting error while taking screenshot and create bitmap with cropping picture

below is my code

    View v1 = mKittyBGLayer.getRootView();
    v1         


        
4条回答
  •  我在风中等你
    2020-12-09 12:21

    Bitmap resultBitmap = Bitmap.createBitmap(sourceBitmap, 0, 0,
            sourceBitmap.getWidth() - 1, sourceBitmap.getHeight() - 1);
    

    Like in lists, it starts from 0, so width must be bitmap width - 1.

提交回复
热议问题