Android Tutorial Immersive Mode with Notch area support

Discussion in 'Tutorials & Examples' started by Brandsum, Dec 20, 2018.

  1. Brandsum

    Brandsum Active Member Licensed User

    Original tutorial: Immersive Mode - hide the navigation bar (by @Erel )

    So the above tutorial works for those devices which do not have a Notch. Devices with a notch will crop the bottom of the application content.

    Solution (Project attached):
    Add this code to GetRealSize sub of the original tutorial after lv.Height = point.GetField("y"):
    Dim r As Rect
    Dim WindowVisibleDisplayFrame As JavaObject = ctxt.RunMethodJO("getWindow"Null)
    WindowVisibleDisplayFrame = WindowVisibleDisplayFrame.RunMethodJO(
    WindowVisibleDisplayFrame = WindowVisibleDisplayFrame.RunMethodJO(

    If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then
        lv.Width = lv.Width - r.left
        lv.Height = lv.Height -
    End If
    If it has a Notch and you want to use the Notch area then just add this code to Manifest:
    SetApplicationAttribute(android:theme, "@style/CustomTheme")

    CreateResource(values, theme.xml,
        <style name=
    "CustomTheme" parent="@android:style/Theme.Holo.Light">
            <item name=
    NOTE: android:windowLayoutInDisplayCutoutMode provided by the APIs in Android Pie 9.0 (API 28).

    Attached Files:

    Last edited: Dec 21, 2018
  2. capisx

    capisx Member Licensed User

    thank you very much for your help @Brandsum.

    The code above works well, since my project was in landscape so i just changed the code:
    lv.Height = lv.Height -
    lv.Width = lv.Width - r.Left
  3. capisx

    capisx Member Licensed User

    I've tested it in landscape and If i don't change that part it will return the wrong screen size because the notch bar is in the left side off screen not in the top of screen
  4. Brandsum

    Brandsum Active Member Licensed User

    Yup you are right. I have updated the tutorial for both orientaion.
  5. DonManfred

    DonManfred Expert Licensed User

    You should post questions in a new thread in the questionsforum instead of posting to an Tutorial.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice