第一种:
使用setDrawingCacheEnabled()和getDrawingCache()这两种方法,第一个是为了设置是否开启缓存,第二个就可以直接获得imageview中的缓存,一般来说需要在获得缓存以后setDrawingCacheEnabled设置为false,因为这样才能让之前的缓存去掉,不会影响后来新的缓存。
ImageView image = (ImageView) view.getTag();
Matrix max = new Matrix();
image.setDrawingCacheEnabled(true);
Bitmap bm = image.getDrawingCache();
第二种:
Bitmap bm =((BitmapDrawable) ((ImageView) image).getDrawable()).getBitmap();
博客介绍了获取ImageView缓存的方法。可使用setDrawingCacheEnabled()设置是否开启缓存,用getDrawingCache()直接获得imageview中的缓存。获取缓存后,需将setDrawingCacheEnabled设为false,以去掉之前的缓存,避免影响新缓存。
2003

被折叠的 条评论
为什么被折叠?



