Android how to capture shadow in screenshots

Viewed 467

How to capture shadow or elevation of views in the layout of the activity in a screenshots.This code take a screenshot for the view but it's not showing the shadow of the viewsenter image description here

View screenView = parentMain;
    screenView.buildDrawingCache();
    screenView.setDrawingCacheEnabled(true);
    Bitmap bitmap = Bitmap.createBitmap(screenView.getWidth() , screenView.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(bitmap);
    screenView.layout(0, 0, screenView.getLayoutParams().width, screenView.getLayoutParams().height);
    screenView.draw(c);
    screenView.setDrawingCacheEnabled(false);
    fakeImgView.setImageBitmap(bitmap);

Even if we add the harware acceleration at activity level it does not provides any effect.

Appreciate any alternative approaches enter image description here

the result

enter image description here

1 Answers
Related