ShapeOfView icon indicating copy to clipboard operation
ShapeOfView copied to clipboard

Big Drawing Bug

Open Uni2K opened this issue 5 years ago • 2 comments

Unfortunately when you try to create a Bitmap from the View it wont show the correct View.

How it looks when added as a view: screenshot_20180803-174721

How it looks when taking a bitmap from this view: screenshot_20180803-174735

The method you use to create the bitmap is totally arbitrary:

DisplayMetrics dm = getResources().getDisplayMetrics(); v.measure(View.MeasureSpec.makeMeasureSpec(dm.widthPixels, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(dm.heightPixels, View.MeasureSpec.EXACTLY)); v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); Bitmap returnedBitmap = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(returnedBitmap); v.draw(c);

or something like: setDrawingCacheEnabled(true); buildDrawingCache(); getDrawingCache();

It really doesn't depend on the way you use to create the screenshot.

Uni2K avatar Aug 03 '18 15:08 Uni2K

@Uni2K Did you find a solution for this?

nareninindia avatar Apr 25 '19 17:04 nareninindia

@Uni2K Did you find a solution for this?

No, unresolvable. I ended up creating my own stuff. Its not that hard. There are plenty of "path mask views/layouts" out there. Things like: https://android-arsenal.com/details/1/683

Uni2K avatar Apr 25 '19 18:04 Uni2K