Converting a view to Bitmap without displaying it in Android?

前端 未结 9 1874
渐次进展
渐次进展 2020-11-22 07:36

I will try to explain what exactly I need to do.

I have 3 separate screens say A,B,C. There is another screen called say HomeScreen where all the 3 screens bitmap sh

9条回答
  •  [愿得一人]
    2020-11-22 08:12

    Hope this helps

    View view="some view instance";        
    view.setDrawingCacheEnabled(true);
    Bitmap bitmap=view.getDrawingCache();
    view.setDrawingCacheEnabled(false);
    

    Update
    getDrawingCache() method is deprecated in API level 28. So look for other alternative for API level > 28.

提交回复
热议问题