1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > android 得到屏幕尺寸 状态栏尺寸 标题栏尺寸

android 得到屏幕尺寸 状态栏尺寸 标题栏尺寸

时间:2018-08-15 18:58:07

相关推荐

android 得到屏幕尺寸 状态栏尺寸 标题栏尺寸

屏幕尺寸:

WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);

intscreenWidth = wm.getDefaultDisplay().getWidth();

intscreenHeight = wm.getDefaultDisplay().getHeight();

状态栏尺寸:

Rectframe=newRect();

getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);

intstatusBarHeight=frame.top;

标题栏尺寸:

intcontentTop=getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();

//statusBarHeight是上面所求的状态栏的高度

inttitleBarHeight=contentTop-statusBarHeight

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。