Android Question One B4XDrawer over several B4XPages


Well-Known Member
Licensed User
Longtime User
Is there a way to use only one B4Xdrawer for all pages? Like an Layer over all Pages.
I want to have one sidebar where i can switch to different screens.

Right now there are some points wich i find unattractive:
- I need to create a new drawer for every page
- I need to setback the drawer content manually to be fresh if i call that screen again.
- If i switch the page the drawer disappear immediately. It would be nicer if the the new page apears in the background and the drawer closes with the animation

Thx in advance


B4X founder
Staff member
Licensed User
Longtime User
In B4A it is possible to add the drawer in the Main module and it will be accessible in all pages:
Sub Globals
    Private Drawer As B4XDrawer
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Drawer.Initialize(Me, "Drawer", Activity, 200dip)
    Dim pm As B4XPagesManager
End Sub

It is not cross platform and isn't flexible.

A better approach is to implement all the drawer related code in a class and create a class instance in each of the pages.
Upvote 0