作者热门文章
- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.zx.zxutils.util.ZXScreenUtil.getScreenHeight()
方法的一些代码示例,展示了ZXScreenUtil.getScreenHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZXScreenUtil.getScreenHeight()
方法的具体详情如下:
包路径:com.zx.zxutils.util.ZXScreenUtil
类名称:ZXScreenUtil
方法名:getScreenHeight
[英]获取屏幕的高度(单位:px)
[中]获取屏幕的高度(单位:px)
代码示例来源:origin: StannyBing/ZXUtils
private static Rect calculateTapArea(float x, float y, float coefficient, Context context) {
float focusAreaSize = 300;
int areaSize = Float.valueOf(focusAreaSize * coefficient).intValue();
int centerX = (int) (x / ZXScreenUtil.getScreenWidth() * 2000 - 1000);
int centerY = (int) (y / ZXScreenUtil.getScreenHeight() * 2000 - 1000);
int left = clamp(centerX - areaSize / 2, -1000, 1000);
int top = clamp(centerY - areaSize / 2, -1000, 1000);
RectF rectF = new RectF(left, top, left + areaSize, top + areaSize);
return new Rect(Math.round(rectF.left), Math.round(rectF.top), Math.round(rectF.right), Math.round(rectF
.bottom));
}
代码示例来源:origin: StannyBing/ZXUtils
/**
* 获取当前屏幕截图,包含状态栏
*
* @param activity
* @return
*/
public static Bitmap getScreenShot(Activity activity) {
View view = activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap bmp = view.getDrawingCache();
int width = getScreenWidth();
int height = getScreenHeight();
Bitmap bp = null;
bp = Bitmap.createBitmap(bmp, 0, 0, width, height);
view.destroyDrawingCache();
return bp;
}
代码示例来源:origin: StannyBing/ZXUtils
/**
* 获取当前屏幕截图,不包含状态栏
*
* @param activity
* @return
*/
public static Bitmap getScreenShotWithoutStatusBar(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();
int height = getScreenHeight();
Bitmap bp = null;
bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
- statusBarHeight);
view.destroyDrawingCache();
return bp;
}
代码示例来源:origin: StannyBing/ZXUtils
break;
case 1://获取屏幕的高度
btnbarView.printInfo("屏幕高度:" + ZXScreenUtil.getScreenHeight());
break;
case 2://设置屏幕为横屏
本文整理了Java中com.zx.zxutils.util.ZXScreenUtil.getScreenHeight()方法的一些代码示例,展示了ZXScreenUtil.getScreenHeigh
本文整理了Java中com.koolearn.klibrary.core.library.ZLibrary.getScreenHeight()方法的一些代码示例,展示了ZLibrary.getScre
我是一名优秀的程序员,十分优秀!