B4A Library [B4X][XUI] WobbleMenu - a cross platform animated bottom navigation

Hi everyone,

This is a B4X compatible bottom navigation. It has 4 types of tab changing animation and 3 types of icon revealing animation.

ezgif.com-video-to-gif.gif


WobbleMenu
Author:
@Biswajit
Version: 1.5
Dependency: JavaObject, BitmapCreator, XUI
  • WobbleMenu
    • Functions:
      • GetCurrentTab As Int
        Get the current tab id (1 to 5)
      • GetHeight As Int
        Get menu height.
      • SetAnimationType(Animation_Type As Int)
        Set the tab changing animation type. Check properties
      • SetCurrentTab(TabID As Int)
        Set the current tab from 1 to 5
      • SetCurrentTab2(TabID As Int, triggerEvent As Boolean) NEW
        Same as SetCurrentTab. If you set triggerEvent = false then it will not trigger the tab click event.
      • SetIconAppearStyle(Icon_Appear_Style As Int)
        Set icon revealing animation type. Check properties
      • SetTabTextIcon(TabID As Int, Text As String, Icon As String, IconFont As Typeface)
        Set the tab text and icons (TabID must be between 1 to 5)
      • SetTabTextIcon2(TabID As Int, Text As String, Icon As Bitmap, tinted As Boolean) NEW
        Set the tab text and image icon (TabID must be between 1 to 5)
      • SetBadge(TabID As Int, Count As Int, BackColor As Int, TxtColor As Int)
        Set tab badge. (after 99 it will show 99+)
      • RemoveBadge(TabID As Int)
        Remove badge from a tab.
      • SetTabCount(count As Int)
        Set tab count at runtime.
        Count must be either 5 or 3
        Note: You can't change the tab count to 3 if your selected tab id is 4 or 5
      • SetEnableTab(TabID As Int, enable As Boolean)
        Enable or disable a tab.
      • GetEnableTab(TabID As Int) As Boolean
        Check if a tab is enabled or not.
      • SetVisible(show As Boolean, animate As Boolean) NEW
        Set menu visibility
    • Events:
      • Tab1Click
      • Tab2Click
      • Tab3Click
      • Tab4Click
      • Tab5Click
    • Properties:
      • ANIMATION_TYPE_ELASTIC_OUT As Int
      • ANIMATION_TYPE_ELASTIC_IN As Int
      • ANIMATION_TYPE_EASE_OUT As Int
      • ANIMATION_TYPE_EASE_IN As Int
      • ANIMATION_TYPE_NONE As Int
      • ICON_APPEAR_FROM_CENTER As Int
      • ICON_APPEAR_FROM_EDGE As Int
      • ICON_APPEAR_FADE_IN As Int
      • ICON_APPEAR_NO_ANIMATION As Int
    • Designer Properties:
      • No. of Tabs (Default: 5)
      • Active Tab (Default 3) NEW
      • Background Color (Default: 0xFFFFFFFF)
      • Shadow Color (Default: Dark)
      • Icon Color (Default: 0xFFBBBBBB)
      • Icon Size (Default: 18)
      • Text Color (Default: 0xFFFFFFFF)
      • Text Size (Default: 14)
      • Selected Icon Color (Default: 0xFF000000)
      • Icon Appear Style (Default: FROM EDGE)
      • Animation Type (Default: ELASTIC OUT)
      • Animation Duration (Default: 500)
You can implement your own animation. Check this link.
Copy the library to the additional library folder then run the examples. Have fun!

UPDATE v1.2 (Latest Examples and Library Attached):
  1. Added 3 Tabs option to designer properties
  2. Added Icon Fade In and no animation option
  3. Fixed SetTabIcon method, previously it was unable to handle any TabID value other than 1 to 5
UPDATE v1.3:
  1. Added Shadow Type (Light/Dark) Option
UPDATE v1.4:
  1. Now you can add text under icons
  2. Now you can add a badge to each tab
  3. Control icon size, text color, and text size from the designer.
  4. More smooth curve.
UPDATE v1.41: Fixed a variable mismatch error.
UPDATE v1.42: Added getHeight method.
UPDATE v1.43:
  1. Change tab count at runtime
  2. Get or set the tab enable status.
UPDATE v1.44:
  1. Minor animation bug fixed.
  2. Added b4xpage+viewpager example.
UPDATE v1.5:
  1. Added image icon support.
  2. Added setVisible method.
  3. Added setCurrentTab2 method which supports changing active tab without triggering click event.
  4. Now the default active tab can be selected from the designer.
UPDATE v1.51: Badge visibility bug fix.
 

Attachments

  • B4A_Example.zip
    9.3 KB · Views: 2,127
  • B4i_Example.zip
    110.4 KB · Views: 828
  • B4J_Example.zip
    2.3 KB · Views: 944
  • b4xpage example with viewpager.zip
    487.3 KB · Views: 1,640
  • WobbleMenu.b4xlib
    6.9 KB · Views: 1,613
Last edited:

Biswajit

Active Member
Licensed User
Longtime User
Hi

How can I change Background Color in code
Currently you cant. Cause change the back color needs the view to redraw itself to change color of all its components like the curve, circle button etc.
 

Biswajit

Active Member
Licensed User
Longtime User

CaptKronos

Active Member
Licensed User
Tapping quickly (~0.5s) between tabs often results in a tab icon not being drawn and hence a blank space being shown. I think it's because the icon drawing animation doesn't have time to complete before the next tab has been tapped.
 

saeed10051

Active Member
Licensed User
Longtime User
Hi Nice work
how can i add menu items in these menus, and how to add additional forms/views where there are different buttons and text to do further processing
 

Biswajit

Active Member
Licensed User
Longtime User
Hi Nice work
how can i add menu items in these menus, and how to add additional forms/views where there are different buttons and text to do further processing
Sorry I didn't get your query.
 

saeed10051

Active Member
Licensed User
Longtime User
Sorry I didn't get your query.
i want to make an app in which when i click one of the menu tabs the form showing above change, so that the menu tabs can be used to navigate between different forms. I am trying to put panels for the various tab items but it is giving me error that the panel is not initialized
 

Biswajit

Active Member
Licensed User
Longtime User
i want to make an app in which when i click one of the menu tabs the form showing above change, so that the menu tabs can be used to navigate between different forms. I am trying to put panels for the various tab items but it is giving me error that the panel is not initialized
You can use AHViewPager, Add multiple panels to that view pager. On click event of each tab of this menu just scroll to a page you want.
 

asales

Expert
Licensed User
Longtime User
It's possible to change the Nº of Tabs by code, to create a dynamic menu in runtime?
 

Biswajit

Active Member
Licensed User
Longtime User
It's possible to change the Nº of Tabs by code, to create a dynamic menu in runtime?
Yes. I will post an update.
 

sigster

Active Member
Licensed User
Longtime User
Hi how can I set Badget to zero, if I add 0 then it disaper

B4X:
WobbleMenu1.SetBadge(5,0,Colors.White,Colors.Blue)
 

Biswajit

Active Member
Licensed User
Longtime User
Hi how can I set Badget to zero, if I add 0 then it disaper

B4X:
WobbleMenu1.SetBadge(5,0,Colors.White,Colors.Blue)
I think 0 means no badge. Like in ios when an app has no (0) notification then it shows no badge. Like the notification icon of this forum shows a badge when there is a notification.

Though if you want to show 0 badge then open the b4xlib, import the bas file to your project, and remove the 0 input checking from the SetBadge method.
 
Top