當前位置: 首頁>>代碼示例>>Java>>正文


Java View.destroyDrawingCache方法代碼示例

本文整理匯總了Java中android.view.View.destroyDrawingCache方法的典型用法代碼示例。如果您正苦於以下問題:Java View.destroyDrawingCache方法的具體用法?Java View.destroyDrawingCache怎麽用?Java View.destroyDrawingCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.destroyDrawingCache方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: snapShotWithoutStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,不包含狀態欄
 * 
 * @param activity
 * @return
 */
public static Bitmap snapShotWithoutStatusBar(Activity activity)
{
	View view = activity.getWindow().getDecorView();
	view.setDrawingCacheEnabled(true);
	view.buildDrawingCache();
	Bitmap bmp = view.getDrawingCache();
	Rect frame = new Rect();
	activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
	int statusBarHeight = frame.top;

	int width = getScreenWidth(activity);
	int height = getScreenHeight(activity);
	Bitmap bp = null;
	bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
			- statusBarHeight);
	view.destroyDrawingCache();
	return bp;

}
 
開發者ID:codeccc,項目名稱:baselibrary-master,代碼行數:26,代碼來源:ScreenUtils.java

示例2: getViewBitmap

import android.view.View; //導入方法依賴的package包/類
public static Bitmap getViewBitmap(View v) {
    v.clearFocus();
    v.setPressed(false);

    boolean willNotCache = v.willNotCacheDrawing();
    v.setWillNotCacheDrawing(false);

    // Reset the drawing cache background color to fully transparent
    // for the duration of this operation
    int color = v.getDrawingCacheBackgroundColor();
    v.setDrawingCacheBackgroundColor(0);

    if (color != 0) {
        v.destroyDrawingCache();
    }
    v.buildDrawingCache();
    Bitmap cacheBitmap = v.getDrawingCache();
    if (cacheBitmap == null) {
        Log.e("Folder", "failed getViewBitmap(" + v + ")", new RuntimeException());
        return null;
    }

    Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);

    // Restore the view
    v.destroyDrawingCache();
    v.setWillNotCacheDrawing(willNotCache);
    v.setDrawingCacheBackgroundColor(color);

    return bitmap;
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:32,代碼來源:MyBitmapUtil.java

示例3: snapShotWithoutStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,不包含狀態欄
 *
 * @param activity
 * @return
 */
public Bitmap snapShotWithoutStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    Rect frame = new Rect();
    activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
    int statusBarHeight = frame.top;

    int width = getScreenWidth(activity);
    int height = getScreenHeight(activity);
    Bitmap bp = null;
    bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
            - statusBarHeight);
    view.destroyDrawingCache();
    return bp;
}
 
開發者ID:jopenbox,項目名稱:android-lite-utils,代碼行數:24,代碼來源:ScreenUtils.java

示例4: getViewBitmap

import android.view.View; //導入方法依賴的package包/類
private Bitmap getViewBitmap(View v) {
    v.clearFocus();
    v.setPressed(false);

    boolean willNotCache = v.willNotCacheDrawing();
    v.setWillNotCacheDrawing(false);

    int color = v.getDrawingCacheBackgroundColor();
    v.setDrawingCacheBackgroundColor(0);

    if (color != 0) {
        v.destroyDrawingCache();
    }
    v.buildDrawingCache();
    Bitmap cacheBitmap = v.getDrawingCache();
    if (cacheBitmap == null) {
        return null;
    }

    Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);

    v.destroyDrawingCache();
    v.setWillNotCacheDrawing(willNotCache);
    v.setDrawingCacheBackgroundColor(color);

    return bitmap;
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:28,代碼來源:DragDropHelper.java

示例5: snapShotWithoutStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,不包含狀態欄
 *
 * @param activity
 * @return
 */
public static Bitmap snapShotWithoutStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    Rect frame = new Rect();
    activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
    int statusBarHeight = frame.top;

    int width = getScreenWidth(activity);
    int height = getScreenHeight(activity);
    Bitmap bp = null;
    bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
            - statusBarHeight);
    view.destroyDrawingCache();
    return bp;

}
 
開發者ID:zhudongya123,項目名稱:WechatChatroomHelper,代碼行數:25,代碼來源:ScreenUtils.java

示例6: snapShotWithoutStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,不包含狀態欄
 * 
 * @param activity
 * @return
 */
public static Bitmap snapShotWithoutStatusBar(Activity activity) {
	View view = activity.getWindow().getDecorView();
	view.setDrawingCacheEnabled(true);
	view.buildDrawingCache();
	Bitmap bmp = view.getDrawingCache();
	Rect frame = new Rect();
	activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
	int statusBarHeight = frame.top;

	int width = getScreenWidth(activity);
	int height = getScreenHeight(activity);
	Bitmap bp = null;
	bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
			- statusBarHeight);
	view.destroyDrawingCache();
	return bp;

}
 
開發者ID:qsyj,項目名稱:ShortcutMenu,代碼行數:25,代碼來源:ScreenUtil.java

示例7: snapShotWithoutStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,不包含狀態欄
 */
public static Bitmap snapShotWithoutStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    Rect frame = new Rect();
    activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
    int statusBarHeight = frame.top;

    int width = getScreenWidth(activity);
    int height = getScreenHeight(activity);
    Bitmap bp = null;
    bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
            - statusBarHeight);
    view.destroyDrawingCache();
    return bp;
}
 
開發者ID:jiajieshen,項目名稱:AndroidDevSamples,代碼行數:21,代碼來源:ScreenUtil.java

示例8: snapShotWithoutStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,不包含狀態欄(這個方法沒測試通過)
 * 
 * @param activity
 * @return Bitmap
 */
public static Bitmap snapShotWithoutStatusBar(Activity activity) {
	View view = activity.getWindow().getDecorView();
	view.setDrawingCacheEnabled(true);
	view.buildDrawingCache();
	Bitmap bmp = view.getDrawingCache();
	Rect frame = new Rect();
	activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
	int statusBarHeight = frame.top;

	int width = getScreenWidth(activity);
	int height = getScreenHeight(activity);
	Bitmap bp = null;
	bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
			- statusBarHeight);
	view.destroyDrawingCache();
	return bp;
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:24,代碼來源:DisplayUtil.java

示例9: 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

示例10: captureWithoutStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,不包含狀態欄
 *
 * @param activity activity
 * @return Bitmap
 */
public static Bitmap captureWithoutStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    int statusBarHeight = BarUtils.getStatusBarHeight(activity);
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    Bitmap ret = Bitmap.createBitmap(bmp, 0, statusBarHeight, dm.widthPixels, dm.heightPixels - statusBarHeight);
    view.destroyDrawingCache();
    return ret;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:19,代碼來源:ScreenUtils.java

示例11: createFloatView

import android.view.View; //導入方法依賴的package包/類
/**
 * @param coverView 被覆蓋的view,用於生產浮層View
 * @return 需要跟隨手勢浮動的 View
 */
protected View createFloatView(View coverView) {
    ImageView floatView = new ImageView(coverView.getContext());
    coverView.destroyDrawingCache();
    coverView.setDrawingCacheEnabled(true);
    Bitmap bitmap = coverView.getDrawingCache();
    if (bitmap != null && !bitmap.isRecycled()) {
        floatView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        floatView.setImageBitmap(bitmap);
    }
    return floatView;
}
 
開發者ID:free46000,項目名稱:MultiItem,代碼行數:16,代碼來源:DragFloatViewHelper.java

示例12: snapShotWithStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,包含狀態欄
 *
 * @param activity Activity
 * @return 屏幕截圖
 */
public static Bitmap snapShotWithStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    int width = DeviceInfo.getScreenWidth();
    int height = DeviceInfo.getScreenHeight();
    Bitmap bp = Bitmap.createBitmap(bmp, 0, 0, width, height);
    view.destroyDrawingCache();
    return bp;
}
 
開發者ID:sundevin,項目名稱:utilsLibrary,代碼行數:18,代碼來源:ActivityUtils.java

示例13: captureWithStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,包含狀態欄
 *
 * @param activity activity
 * @return Bitmap
 */
public static Bitmap captureWithStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    Bitmap ret = Bitmap.createBitmap(bmp, 0, 0, dm.widthPixels, dm.heightPixels);
    view.destroyDrawingCache();
    return ret;
}
 
開發者ID:Jay-Ping,項目名稱:newIPlay,代碼行數:18,代碼來源:ScreenUtils.java

示例14: snapShotWithStatusBar

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取當前屏幕截圖,包含狀態欄
 *
 * @param activity
 * @return
 */
public Bitmap snapShotWithStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    int width = getScreenWidth(activity);
    int height = getScreenHeight(activity);
    Bitmap bp = null;
    bp = Bitmap.createBitmap(bmp, 0, 0, width, height);
    view.destroyDrawingCache();
    return bp;
}
 
開發者ID:jopenbox,項目名稱:android-lite-utils,代碼行數:19,代碼來源:ScreenUtils.java

示例15: convertViewToBitmap

import android.view.View; //導入方法依賴的package包/類
public static Bitmap convertViewToBitmap(View view) {
    if (view.getLayoutParams() == null) {
        view.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
    }

    measureView(view);
    view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    view.destroyDrawingCache();
    view.buildDrawingCache();
    return view.getDrawingCache();
}
 
開發者ID:Tamicer,項目名稱:FilterBar,代碼行數:12,代碼來源:UIUtil.java


注:本文中的android.view.View.destroyDrawingCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。