#Region Project Attributes
#ApplicationLabel: B4XBottomMenu Sample
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#BridgeLogger: True
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private xui As XUI
Private B4XBottomMenu1 As B4XBottomMenu
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
Activity.Title = "B4XBottomMenu Sample"
'set icons fonts
Dim IconsFont As B4XFont
IconsFont = xui.CreateFont(Typeface.LoadFromAssets("icons.ttf"),64)
'set menu
B4XBottomMenu1.SetMenuItems = 4 'default 2 (Range 2 to 5)
B4XBottomMenu1.SetBackgroundColor = xui.Color_White 'default white
'set menu item
B4XBottomMenu1.SetItem(1, "Map", B4XBottomMenu1.SetFontToBitmap(Chr(0xf981), IconsFont, 36, xui.Color_White))
B4XBottomMenu1.SetItem(2, "Routes", B4XBottomMenu1.SetFontToBitmap(Chr(0xfb4a), IconsFont, 36, xui.Color_White))
B4XBottomMenu1.SetItem(3, "Messages",B4XBottomMenu1.SetFontToBitmap(Chr(0xf189), IconsFont, 36, xui.Color_White))
B4XBottomMenu1.SetItem(4, "Setting", B4XBottomMenu1.SetFontToBitmap(Chr(0xf8ba), IconsFont, 36, xui.Color_White))
B4XBottomMenu1.SetItem(5, "Other", B4XBottomMenu1.SetFontToBitmap(Chr(0xf433), IconsFont, 36, xui.Color_White))
' *************** middlebutton ***************
'set color
B4XBottomMenu1.SetMiddleButtonBackgroundColor = xui.Color_Blue
'set icon
B4XBottomMenu1.SetMiddleButtonIcon = B4XBottomMenu1.SetFontToBitmap(Chr(0xf4fe), IconsFont, 36, xui.Color_White)
B4XBottomMenu1.SetMiddleButtonIconColor = xui.Color_White
'set border
B4XBottomMenu1.SetMiddleButtonBoderSize = 0 'default 0 Not Visible
B4XBottomMenu1.SetMiddleButtonBoderColor = xui.Color_LightGray
'set visible
B4XBottomMenu1.SetMiddleButtonVisible = False 'default False
'set type wave
' B4XBottomMenu1.SetMiddleButtonTypeWave = True 'default False
'set size
B4XBottomMenu1.SetMiddleButtonSize = 80 'default 80% (Range 60% to 80% the height mbase)
' *************** Items ***************
B4XBottomMenu1.SetItemSelected = 1 'default 1 (Max. value SetMenuItems)
B4XBottomMenu1.SetItemTextVisible = True 'default True
'set icons and items color
B4XBottomMenu1.SetItemIconColors(0xFF979799, 0xFF0062CA, 0xFFAEAEB0)
B4XBottomMenu1.SetItemTextColors(0xFF979799, 0xFF0062CA, 0xFFAEAEB0)
'set item badge
B4XBottomMenu1.SetItemBadgeVisible = True 'default False
B4XBottomMenu1.SetItemBadgeColor(2, xui.Color_DarkGray)
'set item underline
B4XBottomMenu1.SetItemUnderlineVisible = False 'default False
B4XBottomMenu1.SetItemUnderlineColor = xui.Color_Blue
B4XBottomMenu1.SetItemUnderlineAnimation = B4XBottomMenu1.ANIMATION_NORMAL
'set Item separator
' B4XBottomMenu1.SetItemSeparatorVisible = True 'default False
B4XBottomMenu1.SetItemSeparatorColor = xui.Color_LightGray
'set Item ripple effect
B4XBottomMenu1.SetItemRippleEffectVisible = True 'default True
B4XBottomMenu1.SetItemRippleEffectColor = xui.Color_Gray 'default color gray
B4XBottomMenu1.SetItemRippleEffectDuration = 300 'default 300
' *************** Test ***************
'set badge value
B4XBottomMenu1.SetItemBadgeValue(3, 10)
'Trigger item menu
B4XBottomMenu1_MenuItemClick(B4XBottomMenu1.GetItemSelected)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub B4XBottomMenu1_MiddleButtonClick
Log($"MiddleButtonClick"$)
End Sub
Sub B4XBottomMenu1_MiddleButtonLongClick
Log($"MiddleButtonLongClick"$)
End Sub
Sub B4XBottomMenu1_MenuItemClick (ItemId As Int)
Log($" Click Item ${ItemId} / badge value ( ${B4XBottomMenu1.GetItemBadgeValue(ItemId)} ) "$)
End Sub