DrawView icon indicating copy to clipboard operation
DrawView copied to clipboard

java.lang.IllegalArgumentException: width and height must be > 0

Open vyasishanatc194 opened this issue 5 years ago • 3 comments

    Bitmap init = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
    mZoomOverlay = init.copy(Bitmap.Config.ARGB_8888, true);
    init.recycle();
    mCanvasOverlay = new Canvas(mZoomOverlay);

    invalidate();

Android Version 10 compileSdkVersion 28 minSdkVersion 14 targetSdkVersion 28 versionCode 14 versionName "1.3.1"

vyasishanatc194 avatar Dec 17 '19 04:12 vyasishanatc194

call like this or wait to start app

new Handler().postDelayed(new Runnable() { @Override public void run() { Bitmap icon = BitmapFactory.decodeResource(getResources(),R.drawable.mypic); mDrawView.setBackgroundImage(icon, BackgroundType.BITMAP, BackgroundScale.CENTER_INSIDE); } }, 1000);

verinder84 avatar Jul 13 '20 09:07 verinder84

thanks to byox great project, I cloned the project and fixed this bug. feel free to use it. implementation 'com.github.salario07:DrawView:1.0.4'

also see latest version from here: https://jitpack.io/#salario07/DrawView

salario07 avatar Dec 21 '20 08:12 salario07

    Bitmap init = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
    mZoomOverlay = init.copy(Bitmap.Config.ARGB_8888, true);
    init.recycle();
    mCanvasOverlay = new Canvas(mZoomOverlay);

    invalidate();

Android Version 10 compileSdkVersion 28 minSdkVersion 14 targetSdkVersion 28 versionCode 14 versionName "1.3.1"

having same issue when zoom is enabled

sufwankhalid avatar Jan 03 '21 14:01 sufwankhalid