本文整理汇总了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());
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}