2

I want get real (!) status or height of both (system and navigation) bars on Android device with root when they bars are hidden.

Bars hidden by superuser commands: Android - Show/Hide system bar.

I try get height of system and navigation bars by System bar size on android tablets:

// status bar (at the top of the screen on a Nexus device) 
public static int getStatusBarHeight(Context context) {
    Resources resources = context.getResources();
    int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
    if (resourceId > 0) {
        return resources.getDimensionPixelSize(resourceId);
    }
    return 0;
}

// navigation bar (at the bottom of the screen on a Nexus device)
public static int getNavigationBarHeight(Context context) {
    Resources resources = context.getResources();
    int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    if (resourceId > 0) {
        return resources.getDimensionPixelSize(resourceId);
    }
    return 0;
}

But this method return virtual height: status bar - 38 px, navigation bar - 72 px on my device.

I need get this sizes only when bars really showed on screen. And return 0 in my case with hidden bars.

Is it possible get real height?

Also may be is possible get status system and navigation bars: hidden or shown?

Community
  • 1
  • 1
Tapa Save
  • 4,769
  • 5
  • 32
  • 54

0 Answers0