Android Question hide navigation buttons from code

scsjc

Well-Known Member
Licensed User
Longtime User
I would like to know how to hide the navigation buttons from code.


-In the library : ParsBottomSheetBuilder: https://www.b4x.com/android/forum/threads/parsbottomsheetbuilder.105081/ i see that.... when show a popup menu, the buttons are hidden

-I would like to hide the navigations buttons when show BottomPopupDrawer ... https://www.b4x.com/android/forum/threads/bottom-popup-drawer.111706/#content




Captura.JPG
ezgif.com-video-to-gif (2).gif
 

scsjc

Well-Known Member
Licensed User
Longtime User
ok after having a look seems like my code hides it compleatly alongside the state bar

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:

    Dim lv As LayoutValues = GetRealSize
    Dim jo333 As JavaObject = Activity
    jo333.RunMethod("setBottom", Array(lv.Height))
    jo333.RunMethod("setRight", Array(lv.Width))
    Activity.Height = lv.Height
    Activity.Width = lv.Width
    End Sub
   
   
   
    Sub GetRealSize As LayoutValues
   
    Dim lv As LayoutValues
    Dim po As Phone
    If po.SdkVersion >= 17 Then
        Dim ctxt As JavaObject
        ctxt.InitializeContext
        Dim display As JavaObject = ctxt.RunMethodJO("getSystemService", Array("window")).RunMethod("getDefaultDisplay", Null)
        Dim point As JavaObject
        point.InitializeNewInstance("android.graphics.Point", Null)
        display.RunMethod("getRealSize", Array(point))
        lv.Width = point.GetField("x")
        lv.Height = point.GetField("y")
       
        '''Add android:windowLayoutInDisplayCutoutMode = never in manifest if you don't want to use notch area
        '''Add android:windowLayoutInDisplayCutoutMode = shortEdges in manifest if you want to use notch area
        Dim r As Rect
        r.Initialize(0,0,0,0)
        Dim WindowVisibleDisplayFrame As JavaObject = ctxt.RunMethodJO("getWindow", Null)
        WindowVisibleDisplayFrame = WindowVisibleDisplayFrame.RunMethodJO("getDecorView", Null)
        WindowVisibleDisplayFrame = WindowVisibleDisplayFrame.RunMethodJO("getWindowVisibleDisplayFrame",Array(r))
       
        If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then
            lv.Width = lv.Width - r.left
        Else
            lv.Height = lv.Height - r.top
        End If
    Else
        lv.Width = 100%x
        lv.Height = 100%y
    End If
    lv.Scale = 100dip / 100
    Return lv
   
End Sub

Sub Activity_WindowFocusChanged(HasFocus As Boolean)
   
    If HasFocus Then
        Try
            Dim jo As JavaObject = Activity
            Sleep(300)
            jo.RunMethod("setSystemUiVisibility", Array As Object(5894)) '3846 - non-sticky
        Catch
            'Log(LastException) 'This can cause another error
        End Try 'ignore
       
    End If
   
End Sub


not what you are looking for but can be used as a starting point

I have tried the code, it is the same as immersive mode, but it does not do a blocking effect on the bottom buttons like this library does.

I'll keep looking, thanks :)
 
Upvote 0
Top