名词解析:
方法
/**
//透明状态栏
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