Android Question Immersive Mode

Discussion in 'Android Questions' started by RandomCoder, Feb 5, 2015.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Forum experts, please advise...

    I've been following @corwin42 guides on applying Material design (an excellent read, search the forum for "Material" and you'll see what I mean). I've now got my app displaying in FullScreen mode with my own ToolBar and soon to have modifiable Menu. But the NavigationBar (at the bottom of screen containing Back and Home button) is still on display. I believe to get rid of this I need to enter ImmersiveMode!

    I've followed the advice to use JavaObject to set ImmersiveMode (Android 4.4) and this works but leaves a space where the navigation bar was. The advice to fix this is to use the IME Library to detect the screen change and re-size the panel.... Persist webview through orientation change

    This is probably fine if just resizing one or two controls. But my activity contains the ToolBar and a Panel, I was planning to load the Panel with a Layout scaled correctly to the device in use and this may contain several Views all of which I guess would need to be rescaled/repositioned. Is this advice still the best way of achieving what I require or is it possible to set ImmersiveMode in a Custom theme? However all my attempts to modify the theme have failed to compile :(

    I'm thinking that I'll just live with the NavigationBar being present but thought I'd ask you experts first in case I'm missing something?

    Thanks in advance,
    RandomCoder :D

    PS Could someone please also explain why the Sticky Immersive value is 5894 in the B4A example and yet the Android docs states that it should be 4096?
    (I tried 4096, it doesn't work!)
    Last edited: Feb 5, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    The number is a combination of several flags: IMMERSIVE_STICKY, LAYOUT_FULLSCREEN, HIDE_NAVIGATION and others which I currently don't remember.

    It is problematic to correctly handle the size change, especially if the layout is complicated.
    lemonisdead likes this.
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Thank you @Erel for the explanation. I thought it might be some combination of values and had tried adding IMMERSIVE_STICKY and a FULLSCREEN value (I forget which one) together but this did not add up to 5894 and neither could I find a property with that constant value. That's why I asked the question.

    Thank you for clarifying that it is a combination of values. Is there nothing that can be done using themes? I'd be happy to apply the immersive mode to the whole application if it's possible?
    Does anyone know of another way? Failing that, I think I'll stick with the NavigationBar showing as I don't want to add something that is going to prove problematic.
    I have enough problems without creating myself even more :p
  4. Erel

    Erel Administrator Staff Member Licensed User

    You cannot set immersive mode from a theme.
    RandomCoder likes this.
  5. moster67

    moster67 Expert Licensed User

    Sorry, I know this post is old but it seems proper to post it here anyway.

    This is a weird problem and rather frustrating.
    When you say it is problematic, do you intend with B4A only or is this problem present also when developing in Android (with Android Studio/Eclipse)?
  6. Erel

    Erel Administrator Staff Member Licensed User

  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