Android Question Bottom nav bar covers app from time to time

fastlingo

Member
Licensed User
Longtime User
Sometimes, rarely, when the app starts the Root.height appears to be including the bottom android nav bar. Since I have a webview in full screen, the android buttons cover the bottom area. Is there anything to do about this? As it happens very rarely, it is very hard to debug.

B4X:
    Root = Root1
    Root.AddView(webviews(0),0,0,Root.Width,Root.Height)
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
Sometimes, rarely, when the app starts the Root.height appears to be including the bottom android nav bar. Since I have a webview in full screen, the android buttons cover the bottom area. Is there anything to do about this? As it happens very rarely, it is very hard to debug.

B4X:
    Root = Root1
    Root.AddView(webviews(0),0,0,Root.Width,Root.Height)
same here: an app for which I've set the opt out edge-to-edge and always start correctly, sometimes, coming back from background (I suspect after some time the lock screen has been active) it appears full screen, with the bottom bar overlayed.
I classified it as an Android bug, hoping it will be solved in the next release.
This forced opt-in for edge-to-edge looks to be a false step from Google: I see every kind of app on the market (not B4A) with the nav bar overlayed and buttons underneath.
 
Upvote 0

fastlingo

Member
Licensed User
Longtime User
Chatgpt suggested I should use setlayoutanimated, but I don't know if it works as I can't test it.

B4X:
Sub FixLayout
    ' Always anchor to Activity, not cached values
    webviews(0).SetLayoutAnimated(0, 0, 0, 100%x, 100%y)
    webviews(1).SetLayoutAnimated(0, 0, 0, 100%x, 100%y)
End Sub

Sub FixLayoutDeferred
    Sleep(1)          ' yield a frame so Android completes layout/insets
    FixLayout
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.AddView(webviews(0),0,0,Root.Width,Root.Height)
    Root.AddView(webviews(1),0,0,Root.Width,Root.Height)
    FixLayout
...


Sub resume
    CallSubDelayed(B4XPages.MainPage, "FixLayoutDeferred")
...
 
Upvote 0
Top