当前位置: 首页>>代码示例>>Java>>正文


Java View.setDrawingCacheQuality方法代码示例

本文整理汇总了Java中android.view.View.setDrawingCacheQuality方法的典型用法代码示例。如果您正苦于以下问题:Java View.setDrawingCacheQuality方法的具体用法?Java View.setDrawingCacheQuality怎么用?Java View.setDrawingCacheQuality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.setDrawingCacheQuality方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BlurTask

import android.view.View; //导入方法依赖的package包/类
public BlurTask(View target, BlurFactor factor, Callback callback) {
  target.setDrawingCacheEnabled(true);
  this.res = target.getResources();
  this.factor = factor;
  this.callback = callback;

  target.destroyDrawingCache();
  target.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
  capture = target.getDrawingCache();
  contextWeakRef = new WeakReference<>(target.getContext());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:BlurTask.java

示例2: BlurTask

import android.view.View; //导入方法依赖的package包/类
public BlurTask(View target, BlurFactor factor, Callback callback) {
	this.res = target.getResources();
	this.factor = factor;
	this.callback = callback;
	this.contextWeakRef = new WeakReference<Context>(target.getContext());

	target.setDrawingCacheEnabled(true);
	target.destroyDrawingCache();
	target.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
	bitmap = target.getDrawingCache();
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:12,代码来源:BlurTask.java

示例3: BlurTask

import android.view.View; //导入方法依赖的package包/类
public BlurTask(View target, BlurFactor factor, Callback callback) {
  this.res = target.getResources();
  this.factor = factor;
  this.callback = callback;
  this.contextWeakRef = new WeakReference<>(target.getContext());

  target.setDrawingCacheEnabled(true);
  target.destroyDrawingCache();
  target.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
  bitmap = target.getDrawingCache();
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:12,代码来源:BlurTask.java

示例4: createBitmap

import android.view.View; //导入方法依赖的package包/类
public Bitmap createBitmap(final Context context, RemoteViews remoteViews, boolean isBig, boolean systemId) {
	View mCache = null;
	try {
		mCache = createView(context, remoteViews, isBig, systemId);
	} catch (Throwable throwable) {
		try {
			// apply失败后,根据布局id创建view
			mCache = LayoutInflater.from(context).inflate(remoteViews.getLayoutId(), null);
		} catch (Throwable e) {

		}
	}
	if (mCache == null) {
		return null;
	}
	mCache.setDrawingCacheEnabled(true);
	mCache.buildDrawingCache();
	mCache.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
	return mCache.getDrawingCache();
}
 
开发者ID:codehz,项目名称:container,代码行数:21,代码来源:RemoteViewsUtils.java

示例5: of

import android.view.View; //导入方法依赖的package包/类
public static Bitmap of(View view, BlurFactor factor) {
  view.setDrawingCacheEnabled(true);
  view.destroyDrawingCache();
  view.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
  Bitmap cache = view.getDrawingCache();
  Bitmap bitmap = of(view.getContext(), cache, factor);
  cache.recycle();
  return bitmap;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:Blur.java

示例6: of

import android.view.View; //导入方法依赖的package包/类
public static Bitmap of(View view, BlurFactor factor) {
	view.setDrawingCacheEnabled(true);
	view.destroyDrawingCache();
	view.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
	Bitmap cache = view.getDrawingCache();
	Bitmap bitmap = of(view.getContext(), cache, factor);
	cache.recycle();
	return bitmap;
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:10,代码来源:Blur.java

示例7: onBtnScreenCaptureClicked

import android.view.View; //导入方法依赖的package包/类
@OnClick(R.id.btn_screen_capture)
public void onBtnScreenCaptureClicked() {
    View decorView = getWindow().getDecorView();
    decorView.setDrawingCacheEnabled(true);
    decorView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
    decorView.buildDrawingCache();
    Bitmap screen = Bitmap.createBitmap(decorView.getDrawingCache());
    KDialog.showImgInDialog(this, screen);
}
 
开发者ID:jiangkang,项目名称:KTools,代码行数:10,代码来源:ImageActivity.java

示例8: getBitmapFromView

import android.view.View; //导入方法依赖的package包/类
private static Bitmap getBitmapFromView(View view, int tryTime, boolean forceHighQuality) {
    boolean willNotCacheDrawingBefore = view.willNotCacheDrawing();
    view.setWillNotCacheDrawing(false);

    int drawingCacheBackgroundColorBefore = view.getDrawingCacheBackgroundColor();
    view.setDrawingCacheBackgroundColor(0);
    int drawingCacheQualityBefore = view.getDrawingCacheQuality();
    if (drawingCacheBackgroundColorBefore != 0) {
        view.destroyDrawingCache();
    }
    if (tryTime > 1) {
        view.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
    }
    view.buildDrawingCache();
    Bitmap cacheBitmap = view.getDrawingCache();
    if (cacheBitmap == null || cacheBitmap.isRecycled()) {
        view.setDrawingCacheQuality(drawingCacheQualityBefore);
        view.setWillNotCacheDrawing(willNotCacheDrawingBefore);
        view.setDrawingCacheBackgroundColor(drawingCacheBackgroundColorBefore);

        if (tryTime < TRY_GET_BITMAP_FROM_VIEW_MAX_REPEAT_TIME) {
            handleOutOfMemory();
            return getBitmapFromView(view, tryTime + 1, forceHighQuality);
        }
        return null;
    }

    Bitmap bitmap = createBitmap(cacheBitmap, cacheBitmap.getWidth(), cacheBitmap.getHeight(), forceHighQuality || tryTime == 1 ? Config.ARGB_8888
            : Config.ARGB_4444);

    if (bitmap == cacheBitmap) {
        bitmap = createBitmap(cacheBitmap);
    }

    view.destroyDrawingCache();

    view.setDrawingCacheQuality(drawingCacheQualityBefore);
    view.setWillNotCacheDrawing(willNotCacheDrawingBefore);
    view.setDrawingCacheBackgroundColor(drawingCacheBackgroundColorBefore);

    return bitmap;
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:43,代码来源:BitmapUtils.java


注:本文中的android.view.View.setDrawingCacheQuality方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。