本文整理了Java中android.widget.ImageView.destroyDrawingCache()
方法的一些代码示例,展示了ImageView.destroyDrawingCache()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.destroyDrawingCache()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:destroyDrawingCache
暂无
代码示例来源:origin: TommyLemon/APIJSON
@Override
public void onDestroy() {
if (leftMenu != null) {
leftMenu.destroyDrawingCache();
leftMenu = null;
}
if (rightMenu != null) {
rightMenu.destroyDrawingCache();
rightMenu = null;
}
super.onDestroy();
}
代码示例来源:origin: TommyLemon/APIJSON
@Override
public void onDestroy() {
if (leftMenu != null) {
leftMenu.destroyDrawingCache();
leftMenu = null;
}
if (rightMenu != null) {
rightMenu.destroyDrawingCache();
rightMenu = null;
}
super.onDestroy();
}
代码示例来源:origin: stackoverflow.com
public static void stripImageView(ImageView view) {
if ( view.getDrawable() instanceof BitmapDrawable ) {
((BitmapDrawable)view.getDrawable()).getBitmap().recycle();
}
view.getDrawable().setCallback(null);
view.setImageDrawable(null);
view.getResources().flushLayoutCache();
view.destroyDrawingCache();
}
代码示例来源:origin: GeoODK/collect
public void recycleDrawables() {
List<ImageView> images = new ArrayList<ImageView>();
// collect all the image views
recycleDrawablesRecursive(this, images);
for ( ImageView imageView : images ) {
imageView.destroyDrawingCache();
Drawable d = imageView.getDrawable();
if ( d != null && d instanceof BitmapDrawable) {
imageView.setImageDrawable(null);
BitmapDrawable bd = (BitmapDrawable) d;
Bitmap bmp = bd.getBitmap();
if ( bmp != null ) {
bmp.recycle();
}
}
}
}
代码示例来源:origin: zxfnicholas/CameraSDK
private void getViewBitmap() {
cropimage.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(cropimage.getDrawingCache());
// 清缓存
cropimage.destroyDrawingCache();
int w = cropimage.getWidth();
int h = cropimage.getHeight();
//itbmp = Bitmap.createBitmap(bitmap, 0, 0, 640, 640);
itbmp = Bitmap.createBitmap(bitmap, 0, 0, w, w);
bitmap=ThumbnailUtils.extractThumbnail(bitmap, 640, 640);// 缩放图片到指定的宽高到640px
}
代码示例来源:origin: mnafian/ImageEffectFilter
testimage.destroyDrawingCache();
代码示例来源:origin: wsy858/android-headimage-cliper
/**
* 获取剪切图
*/
public Bitmap clip() {
imageView.setDrawingCacheEnabled(true);
imageView.buildDrawingCache();
Rect rect = clipView.getClipRect();
Bitmap cropBitmap = null;
Bitmap zoomedCropBitmap = null;
try {
cropBitmap = Bitmap.createBitmap(imageView.getDrawingCache(), rect.left, rect.top, rect.width(), rect.height());
zoomedCropBitmap = zoomBitmap(cropBitmap, 200, 200);
} catch (Exception e) {
e.printStackTrace();
}
if (cropBitmap != null) {
cropBitmap.recycle();
}
// 释放资源
imageView.destroyDrawingCache();
return zoomedCropBitmap;
}
代码示例来源:origin: stackoverflow.com
ImageView img= new ImageView();
img=(ImageView) rrr.getChildAt(0);
img.setRotation(90);
img.setDrawingCacheEnabled(true);
img.buildDrawingCache();
if(img.isDrawingCacheEnabled()){
Bitmap bitmap =img.getDrawingCache(true);
}img.destroyDrawingCache();
img.setDrawingCacheEnabled(false);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100,
bao);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
BitmapDrawable bmd = new BitmapDrawable(rotatedBitmap);
rrr.removeViewAt(0);
ImageView img_new=new ImageView(ImageSlideShow.this);
img_new.setImageDrawable(bmd);
img_new.setScaleType(ScaleType.CENTER);
rrr.addView(img_new, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
代码示例来源:origin: stackoverflow.com
imageView.destroyDrawingCache();
imageView.refreshDrawableState();
imageView.setImageDrawable(drawables[i]);
代码示例来源:origin: blurpy/kouchat-android
private int getColorFromPreviewImage(final ImageView previewImage) {
previewImage.buildDrawingCache();
final Bitmap drawingCache = previewImage.getDrawingCache();
final int pixelColor = drawingCache.getPixel(10, 10);
previewImage.destroyDrawingCache();
return pixelColor;
}
内容来源于网络,如有侵权,请联系作者删除!