B4A Library [B4X] [XUI] AS FloatingActionMenu

This view makes it quick and easy to let the user make an action.

You need:
I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal or with a coffee. :)

IMG_7521.jpg
IMG_7522.jpg


RPReplay_Final1716205211-ezgif.com-resize.gif


Simple Example:
    FloatingActionMenu.Initialize(Me,"FloatingActionMenu",Root)

    FloatingActionMenu.AddItem("Item #1",Null,0)
    FloatingActionMenu.AddItem("Item #2",Null,1)
    FloatingActionMenu.AddItem("Item #3",Null,2)
 
    Dim Height As Float = FloatingActionMenu.ItemProperties.Height*FloatingActionMenu.Size
    Dim Left As Float = xlbl_OpenMenuDark.Left + xlbl_OpenMenuDark.Width + 10dip
    Dim Top As Float = xlbl_OpenMenuDark.Top + xlbl_OpenMenuDark.Height/2 - Height/2
 
    FloatingActionMenu.ShowPicker(Left,Top,200dip,Height)
 
    Wait For FloatingActionMenu_ItemClicked(Item As AS_FloatingActionMenu_Item)
 
    Select Item.Value
        Case 0
            Log(Item.Text & " clicked")
        Case 1
            Log(Item.Text & " clicked")
        Case 2
            Log(Item.Text & " clicked")
    End Select

Dark Example:
    FloatingActionMenu.Initialize(Me,"FloatingActionMenu",Root)
 
    FloatingActionMenu.Color = xui.Color_ARGB(255,32, 33, 37)
    FloatingActionMenu.TextColor = xui.Color_White
    FloatingActionMenu.ItemProperties.SeperatorVisible = True

'    FloatingActionMenu.AddItem("Item #1",Null,0)
'    FloatingActionMenu.AddItem("Item #2",Null,1)
'    FloatingActionMenu.AddItem("Item #3",Null,2)
 
    FloatingActionMenu.AddItem("Item #1",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_White),0)
    FloatingActionMenu.AddItem("Item #2",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_White),1)
    FloatingActionMenu.AddItem("Item #3",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_White),2)
 
    Dim Height As Float = FloatingActionMenu.ItemProperties.Height*FloatingActionMenu.Size
    Dim Left As Float = xlbl_OpenMenuDark.Left + xlbl_OpenMenuDark.Width + 10dip
    Dim Top As Float = xlbl_OpenMenuDark.Top + xlbl_OpenMenuDark.Height/2 - Height/2
 
    FloatingActionMenu.ShowPicker(Left,Top,200dip,Height)
 
    Wait For FloatingActionMenu_ItemClicked(Item As AS_FloatingActionMenu_Item)
 
    Select Item.Value
        Case 0
            Log(Item.Text & " clicked")
        Case 1
            Log(Item.Text & " clicked")
        Case 2
            Log(Item.Text & " clicked")
    End Select

Light Example:
    FloatingActionMenu.Initialize(Me,"FloatingActionMenu",Root)
 
    FloatingActionMenu.Color = xui.Color_White
    FloatingActionMenu.TextColor = xui.Color_Black
    FloatingActionMenu.ItemProperties.SeperatorVisible = True

'    FloatingActionMenu.AddItem("Item #1",Null,0)
'    FloatingActionMenu.AddItem("Item #2",Null,1)
'    FloatingActionMenu.AddItem("Item #3",Null,2)
 
    FloatingActionMenu.AddItem("Item #1",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),0)
    FloatingActionMenu.AddItem("Item #2",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),1)
    FloatingActionMenu.AddItem("Item #3",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),2)
 
    Dim Height As Float = FloatingActionMenu.ItemProperties.Height*FloatingActionMenu.Size
    Dim Left As Float = xlbl_OpenMenuLight.Left + xlbl_OpenMenuLight.Width + 10dip
    Dim Top As Float = xlbl_OpenMenuLight.Top + xlbl_OpenMenuLight.Height/2 - Height/2
 
    FloatingActionMenu.ShowPicker(Left,Top,200dip,Height)
 
    Wait For FloatingActionMenu_ItemClicked(Item As AS_FloatingActionMenu_Item)
 
    Select Item.Value
        Case 0
            Log(Item.Text & " clicked")
        Case 1
            Log(Item.Text & " clicked")
        Case 2
            Log(Item.Text & " clicked")
    End Select


AS_FloatingActionMenu
Author: Alexander Stolte
Version: 1.00

  • AS_FloatingActionMenu
    • Events:
      • ItemClicked (Item As AS_BottomActionSheet_Item)
      • MenuClosed
    • Fields:
      • Tag As Object
    • Functions:
      • AddItem (Text As String, Icon As B4XBitmap, Value As Object) As String
      • Class_Globals As String
      • CreateAS_FloatingActionMenu_Item (Text As String, Icon As B4XBitmap, Value As Object, ItemProperties As AS_FloatingActionMenu_ItemProperties) As AS_FloatingActionMenu_Item
      • CreateAS_FloatingActionMenu_ItemProperties (Height As Float, IconLeftGap As Float, TextLeftGap As Float, xFont As B4XFont, TextColor As Int, IconWidthHeight As Float, SeperatorVisible As Boolean, SeperatorColor As Int) As AS_FloatingActionMenu_ItemProperties
      • FontToBitmap (text As String, IsMaterialIcons As Boolean, FontSize As Float, color As Int) As B4XBitmap
      • getCloseOnTap As Boolean
        Default: True
      • getColor As Int
      • getCornerRadius As Float
        Default: 10dip
      • GetCustomDrawItem (Index As Int) As AS_FloatingActionMenu_CustomDrawItem
      • getFloatingPanel As b4j.example.as_floatingpanel
        Can only be used after ShowPicker is called
      • getItemProperties As AS_FloatingActionMenu_ItemProperties
      • getOpenOrientation_BottomTop As String
        Opens the panel from bottom to top
      • getOpenOrientation_LeftBottom As String
        Opens the panel from left to bottom
      • getOpenOrientation_LeftRight As String
        Opens the panel from left to right
      • getOpenOrientation_LeftTop As String
        Opens the panel from left to top
      • getOpenOrientation_None As String
        Opens the panel without slide, but with fade
      • getOpenOrientation_RightBottom As String
        Opens the panel from right to bottom
      • getOpenOrientation_RightLeft As String
        Opens the panel from right to left
      • getOpenOrientation_RightTop As String
        Opens the panel from right to top
      • getOpenOrientation_TopBottom As String
        Opens the panel from top to bottom
      • getSize As Int
        Added item count
      • HidePicker As String
      • Initialize (Callback As Object, EventName As String, Parent As B4XView) As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setCloseOnTap (Enabled As Boolean) As String
      • setColor (Color As Int) As String
      • setCornerRadius (Radius As Float) As String
      • setDuration (Duration As Long) As String
        Default: 150
      • setOpenOrientation (Orientation As String) As String
      • setTextColor (Color As Int) As String
      • ShowPicker (Left As Float, Top As Float, Width As Float, Height As Float)
    • Properties:
      • CloseOnTap As Boolean
        Default: True
      • Color As Int
      • CornerRadius As Float
        Default: 10dip
      • Duration
        Default: 150
      • ItemProperties As AS_FloatingActionMenu_ItemProperties [read only]
      • OpenOrientation
      • OpenOrientation_BottomTop As String [read only]
        Opens the panel from bottom to top
      • OpenOrientation_LeftBottom As String [read only]
        Opens the panel from left to bottom
      • OpenOrientation_LeftRight As String [read only]
        Opens the panel from left to right
      • OpenOrientation_LeftTop As String [read only]
        Opens the panel from left to top
      • OpenOrientation_None As String [read only]
        Opens the panel without slide, but with fade
      • OpenOrientation_RightBottom As String [read only]
        Opens the panel from right to bottom
      • OpenOrientation_RightLeft As String [read only]
        Opens the panel from right to left
      • OpenOrientation_RightTop As String [read only]
        Opens the panel from right to top
      • OpenOrientation_TopBottom As String [read only]
        Opens the panel from top to bottom
      • Size As Int [read only]
        Added item count
      • TextColor
  • AS_FloatingActionMenu_CustomDrawItem
    • Fields:
      • BackgroundPanel As B4XView
      • IconImageView As B4XView
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Item As AS_FloatingActionMenu_Item
      • TextLabel As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_FloatingActionMenu_Item
    • Fields:
      • Icon As B4XBitmap
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • ItemProperties As AS_FloatingActionMenu_ItemProperties
      • Text As String
      • Value As Object
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_FloatingActionMenu_ItemProperties
    • Fields:
      • Height As Float
      • IconLeftGap As Float
      • IconWidthHeight As Float
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • SeperatorColor As Int
      • SeperatorVisible As Boolean
      • TextColor As Int
      • TextLeftGap As Float
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
Changelog
  • 1.00
    • Release
  • 1.01
    • AddItem is now returning the AS_FloatingActionMenu_Item
    • Add "Enabled" property to the AS_FloatingActionMenu_Item
      • Deactivates an item
      • The item is darkened so that the user can see that it is deactivated
Have Fun :)
 

Attachments

  • AS FloatingActionMenu Example.zip
    177.7 KB · Views: 56
  • AS_FloatingActionMenu.b4xlib
    3.8 KB · Views: 46
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.01
    • AddItem is now returning the AS_FloatingActionMenu_Item
    • Add "Enabled" property to the AS_FloatingActionMenu_Item
      • Deactivates an item
      • The item is darkened so that the user can see that it is deactivated
B4X:
    FloatingActionMenu.AddItem("Item #1",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_White),0).Enabled = False
    FloatingActionMenu.AddItem("Item #2",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_White),1)
    FloatingActionMenu.AddItem("Item #3",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_White),2)
(66) mage.png
(67) mage.png
 

Kope

Active Member
Licensed User
I get this error
Error compiling program.
Error description: Unknown member: cornerradius
Error occurred on line: 84
FloatingPanel.CornerRadius = m_CornerRadius
Word: cornerradius
 
Top