其他分享
首页 > 其他分享> > 屏幕相关

屏幕相关

作者:互联网

public Point getScreenSize(Context context) {
Point point = new Point();
WindowManager windowManager = (WindowManager) context.getSystemService(
Context.WINDOW_SERVICE);
//不含虚拟按键
//windowManager.getDefaultDisplay().getSize(point);
//包含虚拟按键
windowManager.getDefaultDisplay().getRealSize(point);
//屏幕宽度
int height = point.y;
//屏幕高度
int width = point.x;
LogUtil.d(TAG + "test() width:" + width + " height:" + height);

return point;
}

标签:Point,point,windowManager,height,width,相关,屏幕
来源: https://www.cnblogs.com/adamli/p/13360147.html