florent37 / ShapeOfView

Give a custom shape to any android view, Material Design 2 ready
Apache License 2.0
3.12k stars 400 forks source link

Big Drawing Bug #24

Open Uni2K opened 5 years ago

Uni2K commented 5 years ago

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.

nareninindia commented 5 years ago

@Uni2K Did you find a solution for this?

Uni2K commented 5 years ago

@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