当前位置: 首页>>代码示例>>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;未经允许,请勿转载。