获取屏幕的大小
DisplayMetrics dm=new DisplayMetrics();
dm=context.getResource.getDisplayMetrics();
int width=dm.widthPixels;
int height=dm.heightPixels;
如果是获取一个窗口的大小
getWindosManager.getDefaluDisplay.getMetrics(dm);
获取状态栏的高
Rect frame=new Rect();
activity.getWindow().getDecoreView().getWindowVisableDisplayFrame(frame);
int height=frame.top;
获取状态栏和标题栏的高度
activity.getWindow.findViewById(Window.ID_ANDROID_CONTENT).getTop();
让屏幕全屏显示
getwindowManager.setflag(WindowManager.LayoutParams.FLAG_FULLSCREAN,WindowManager.LayoutParams.FLAG_FULLSCREAN);
让屏幕无标题栏
requestwindowfeature(Window.FEATURE_NOTITLE);
获取Android屏幕总结
最新推荐文章于 2021-10-05 08:50:33 发布