//Get the height of the status bar by reflection, the return is the height of the status bar
public int getStatusHeight(){
try {
Class<?> c = Class.forName("com.android.internal.R$dimen");
Object o = c.newInstance();
Field field = c.getField("status_bar_height");
int x = (int) field.get(o);
return mContext.getResources().getDimensionPixelOffset(x);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
Read More:
- Writing to settings when appium of Xiaomi mobile phone and oppo mobile phone starts requires:android.permission.WRITE_ SECURE_ SETTINGS
- Android get screen width and height and get control width and height
- Mobile phone code termux
- JS Mobile Page to determine whether it is iPhone X, and then set the corresponding height of the element?
- Adobe finally launched Photoshop fix on Android, a powerful mobile phone map revision app
- Mobile phone code scanning applet login authorization error
- The Ubuntu status bar shows the network speed, memory and CPU utilization ratio
- Android gets the height and width of the screen
- User defined height of layeui carousel
- Two methods of fixing WPF menu bar after scrolling to the top
- Mobile app development: installation and configuration of react native
- Syntax Error: SassError: Invalid CSS after “…-height: #{math“: expected expression (e.g. 1px, bold
- AttributeError:‘AxesSubplot’object has no attribute‘bar_label’
- Solution of no response of progress bar in MFC program
- Compatibility of mobile display frame
- Origin — draw the curve with error bar
- Using Fiddler to capture mobile app
- Position change of Ubuntu menu bar (left, bottom)
- The problem of mobile hybrid development RN Android deployment appears Unsupported class file major version xx