Android - 获取屏幕分辨率
作者:互联网
kotlin
val windowManager = window.windowManager
val point = Point()
windowManager.defaultDisplay.getRealSize(point)
//屏幕实际宽度(像素个数)
val width: Int = point.x
//屏幕实际高度(像素个数)
val height: Int = point.y
java
WindowManager windowManager = getWindow().getWindowManager();
Point point = new Point();
windowManager.getDefaultDisplay().getRealSize(point);
//屏幕实际宽度(像素个数)
int width = point.x;
//屏幕实际高度(像素个数)
int height = point.y;
标签:val,point,分辨率,Point,windowManager,像素,Android,屏幕 来源: https://blog.csdn.net/weixin_43707799/article/details/121967453