當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。