Android分别获取导航栏、状态栏高度
2018-03-06 12:01
579 查看
名词解析:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[/code]
方法 /** //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //透明导航栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); * 获取状态栏高度 * @param context * @return */ public static int getStatusBarHeight(Context context) { int result = 0; int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = context.getResources().getDimensionPixelSize(resourceId); } return result; } /** * 获取导航栏高度 * @param context * @return */ public static int getDaoHangHeight(Context context) { int result = 0; int resourceId=0; int rid = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android"); if (rid!=0){ resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android"); CMLog.show("高度:"+resourceId); CMLog.show("高度:"+context.getResources().getDimensionPixelSize(resourceId) +""); return context.getResources().getDimensionPixelSize(resourceId); }else return 0; }1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[/code]
相关文章推荐
- Android——分别获取导航栏、状态栏高度
- Android 获取系统顶部状态栏高度和底部导航栏的高度
- 获取Android屏幕尺寸、控件尺寸、状态栏/通知栏高度、导航栏高度
- 获取Android屏幕尺寸、控件尺寸、状态栏/通知栏高度、导航栏高度
- 获取Android屏幕尺寸、控件尺寸、状态栏/通知栏高度、导航栏高度
- Android(13)——获取Android屏幕尺寸、控件尺寸、状态栏/通知栏高度、导航栏高度 .
- 获取Android屏幕尺寸、控件尺寸、状态栏/通知栏高度、导航栏高度
- [Android] 获取系统顶部状态栏(Status Bar)与底部导航栏(Navigation Bar)的高度
- Android学习——获取状态栏,标题栏,导航栏高度的方法
- Android 获取系统顶部状态栏高度和底部导航栏的高度
- Android笔记(九):获取屏幕高度,状态栏高度,虚拟导航栏高度
- 获取Android屏幕尺寸、控件尺寸、状态栏/通知栏高度、导航栏高度
- Android开发之如何获取屏幕、状态栏、导航栏和虚拟功能键的高度
- android 获取系统顶部状态栏(Status Bar)与底部导航栏( 获取底部浮动菜单 Navigation Bar)的高度
- Android 获取屏幕高度、标题高度、状态栏高度详解
- Android开发之有效获取状态栏(StatusBar)高度
- Android获取屏幕高度、标题高度、状态栏高度详解
- iOS获取状态栏和导航栏尺寸(宽度和高度)
- Android获取屏幕、标题栏、状态栏高度
- android 获取屏幕高度,宽度,状态栏高度