Android Question Bottom up Popup Drawer darken status and title

scsjc

Well-Known Member
Licensed User
Longtime User
Using the Bottom Drawer from this example https://www.b4x.com/android/forum/threads/bottom-drawer-not-working-at-b4xpages.126668/#post-792213
I see that the status and title do not darken (first and second figure)

Is there a way to make it look like in the example of the third figure?

1721465185109.png
 

scsjc

Well-Known Member
Licensed User
Longtime User

Does it refer to something like this? or can it be improved?



B4X:
Sub ToggleDrawerState
    Dim Duration As Int = 100
    
    OverlayVisible = Not(OverlayVisible)
    Overlay.SetVisibleAnimated(Duration, OverlayVisible)
    
    Dim pnlBottomVisibleHeight As Int = pnlBottom.Height - 8dip 'hide bottom round corners
    
    If OverlayVisible Then
        SetActionBarColor(Colors.ARGB(150, 0, 0, 0))
        SetStatusBarColor( mixColors(Colors.ARGB(150, 0, 0, 0), Colors.black) )
        pnlBottom.SetLayoutAnimated(0, 0, pnlBottom.Parent.Height, pnlBottom.Width, pnlBottom.Height)
        pnlBottom.SetLayoutAnimated(Duration, 0, pnlBottom.Parent.Height - pnlBottomVisibleHeight, pnlBottom.Width, pnlBottom.Height)
    Else
        SetActionBarColor(Colors.Transparent)
        SetStatusBarColor(Colors.ARGB(150, 0, 0, 0))
        pnlBottom.SetLayoutAnimated(0, 0, pnlBottom.Parent.Height - pnlBottomVisibleHeight, pnlBottom.Width, pnlBottom.Height)
        pnlBottom.SetLayoutAnimated(Duration, 0, pnlBottom.Parent.Height, pnlBottom.Width, pnlBottom.Height)
    End If
End Sub

Sub SetStatusBarColor(Color As Int)
    'status
    Dim jo As JavaObject
    jo.InitializeContext
    Dim window As JavaObject = jo.RunMethodJO("getWindow", Null)
    window.RunMethod("addFlags", Array (0x80000000))
    window.RunMethod("clearFlags", Array (0x04000000))
    window.RunMethod("setStatusBarColor", Array(Color))
End Sub

Sub SetActionBarColor(Color As Int)
    'menu bar
    Dim jo As JavaObject
    jo.InitializeContext
    Dim cd As ColorDrawable
    cd.Initialize(Color, 0)
    jo.RunMethodJO("getActionBar", Null).RunMethod("setBackgroundDrawable", Array(cd))
End Sub
 

Attachments

  • B4XBottomSheet.zip
    12.8 KB · Views: 55
Upvote 0
Top