Search code examples
androidandroid-sourceandroid-windowmanager

How to place Left Navigation Bar behind Status Bar? - SystemUI - Android - AOSP


I've customised Bottom Navigation Bar into Left Side Navigation Bar using TYPE_NAVIGATION_BAR_PANEL in Android AOSP Project. But the problem is it overlaps the Status Bar. Need to put Navigation Bar behind Status Bar.


Solution

  • I think it was intended. StatusBar has lower layer type than navigation type. Which means navigation view is in front of StatusBar.

    /**
     * Window type: the status bar.  There can be only one status bar
     * window; it is placed at the top of the screen, and all other
     * windows are shifted down so they are below it.
     * In multiuser systems shows on all users' windows.
     */
    public static final int TYPE_STATUS_BAR         = FIRST_SYSTEM_WINDOW;
    .....
    /**
     * Window type: Navigation bar (when distinct from status bar)
     * In multiuser systems shows on all users' windows.
     * @hide
     */
    public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
    

    As a walk around, You can modify the layout param of navigation bar. You can set y to getStatusBarHeight() and gravity to Gravity.BOTTOM - Never tested.