Illegalargumentexception: X + Width Must Be <= Bitmap.width() In Android
I want to crop an image with in a margin (10,50,10,50),(left,top,right,bottom) respectively of an imageview. Here is my code Bitmap bitmap = Bitmap.createBitmap(imgView.getWidth(
Solution 1:
try this and see if it works:
// using this method createBitmap(source, x, y, width, height)Bitmapresult= Bitmap.createBitmap(bitmap, 10,
50, imgView.getWidth() - 20, imgView.getHeight() - 100);
getLeft
and others is used to get the position of the view in its parent. Not the dimension of the bitmap.
Post a Comment for "Illegalargumentexception: X + Width Must Be <= Bitmap.width() In Android"