I have a relative layout in my app which im trying to take screenshot of. The problem is that it has CircularImageView in it (https://github.com/lopspower/CircularImageView) and the whole image is transformed and no longer cropped to center.
The code goes like this:
View rl = findViewById(R.id.toBeScreenShot);
rl.setDrawingCacheEnabled(true);
Bitmap screenshot = Bitmap.createBitmap(rl.getWidth(),rl.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(screenshot);
rl.draw(c);
rl.setDrawingCacheEnabled(false);
And this is the result:
The XML code is too big to share, there is a Relative layout that im taking screenshot of (in code, its 'rl'). Then there is a FrameLayout, then two LinearLayouts, some ImageViews and then there is the CircularImageView:
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/userPicture"
android:layout_width="@dimen/_120sdp"
android:layout_height="@dimen/_130sdp"
android:layout_gravity="center"
app:civ_border="false" />
Any idea what might cause this thing to happen?