B4A Library [CLASS] Animated Sliding Menu

This class will allow you to create animated sliding menus.

Requirements:

- B4A 2.xx
- Universal Tween Lib
- Phone Lib
- Add the Class module "AnimatedSlidingMenu.bas" to your project

How to use:

Initialize the class:

Code:
Sub Globals

    Dim MyMenu As AnimatedSlidingMenu

End Sub

Then, create your animated sliding menu:
Code:
'The menu title is optional, pass an empty sting if no title is needed
'If you add a picture to the title's background then enter an * on the title text or
'the title won't show up
myMenu.Initialize(Activity, Me, "Menu Title", "Test", "L", 50dip, 300dip, Colors.Blue, Null)

'Then add items to the menu
myMenu.AddItem(Null, "Item One", Colors.White, Colors.Transparent, 1)
myMenu.AddItem(Null, "Item Two", Colors.White, Colors.Transparent, 2)
myMenu.AddItem(Null, "Item Three", Colors.White, Colors.Transparent, 3)
myMenu.AddItem(Null, "Item Four", Colors.White, Colors.Transparent, 4)

...

'This routine will get the selected menu item, in this case, "Test" is the name of the event
'that will catch the selection, you can name yours with whatever name you like
Sub Test_Click(SelectedItem As Object)
            
    ToastMessageShow("Item selected: " & SelectedItem, False)

End Sub
If you added a title, you can modify its properties like this:
Code:
myMenu.SetTitle(Colors.Red, Colors.White, Gravity.CENTER_HORIZONTAL, Null)

To open the menu use the following code:
Code:
Sub Button1_Click

    myMenu.OpenMenu("Casino")
   
End Sub

There are 8 pre-defined animations included in this class: Default, Casino, CasinoReverse, ShootUp, Cascade, Flip, Fade and ZigZag.

This class supports up to 50 menu items.

That's it!!.

The attached file contains a DEMO and a BAREBONES sample to better understand the use of this class.

Updated on Nov 26, 2012 to version 1.2

Screen shots:

C43h2l.jpg
FW2jgl.png

ptTTPl.png
nSH0Zl.png
 

Attachments

Last edited:
Help Needed

Here's the project, i hope you can see what i'm doing wrong!

Thanks,
Walter
 

Attachments

Great stuff NJDude, one small question. How come all TABS in your code are all over the place? The code is pretty much unreadable without reformatting it.

Cheers and thanks!
 
Tracking when menu is closed

Hi,

I need to find a way to see when the menu is closed by touch. The reason is that I want to slide all of my interface to the right when opening the menu. But, I also want to do this if the menu is closed by touch.

How could I do this?

Cheers.
 
Is it possible to make the scrolling part sizeable in heigth ?
i.e. start at 30dip from the top and ends 30dip above the bottom
 
I tried already, but dont know where exactly.
All failed
 
Amazing Class, i don't know how i didn't came across it before :(
this kind of classes should be marked some how to be more visible ;)
 
Nice class,
I am playing with this class and trying to slide panels on menu click and so for reached some where. see the attached project.
i wish to get it perfect, so how can i optimize the code i mean what can be best way to do this, please help

regards,
 

Attachments

Back
Top