第一种:

使用setDrawingCacheEnabled()和getDrawingCache()这两种方法,第一个是为了设置是否开启缓存,第二个就可以直接获得imageview中的缓存,一般来说需要在获得缓存以后setDrawingCacheEnabled设置为false,因为这样才能让之前的缓存去掉,不会影响后来新的缓存。 

image.setDrawingCacheEnabled(true);    

Bitmap bm = image.getDrawingCache();

image.setDrawableCacheEnabled(false);

第二种: 

 
Bitmap bm =((BitmapDrawable) ((ImageView) image).getDrawable()).getBitmap();  

直接强行获得内部的图片。

相关文章:

  • 2022-12-23
  • 2021-12-14
  • 2021-10-12
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案