B4A Library Side swipe sliding menu library

Hello everybody,
Here we have my second library, I created this library for a project that I'm working on, I've previously used this menu(in a class) on other clients bespoke apps. I've learnt a lot from other forum members, so hopefully you will like my little sliding menu.

Just swipe your finger from off the screen and the menu slides in and out, the top left button also slides the menu in and out when tapped.

A big thank you to @Informatix and @margret for creating libraries that makes my life easier :)

SlidingMenuStd
  • BarsOff
    TURN OFF BARS
  • Initialize (Activity As Activity, Top As Int, SetMenuWidth As Int, SetMenuColor As Int, FontSize As Int, FontColor As Int)
    Current activity, Menu top position, Menu Width, Menu color, Text size, Text color
  • InitializeActionBar (Activity As Activity, ActionBarColor As Int, LineColor As Int, Radius As Int, MenuButton As Boolean)
    Current activity, Action bar color, Thin line color, Action bar corner radius
  • InitializeSwipe (Activity As Activity, Module As Object, SetSlideDuration As Int, SetFadeAlpha As Int, SetMenuLength As Boolean)
    Current activity, Current module name, Menu slide duration in milliseconds, FadeAlpha(0-255), Menu length(Full or just items)

The extra libraries that I used were:
  1. AnimationPlus
  2. ICS Contols
I've built some simple adjustable functionality into this library v1.2+, I hope it's enough for you all.
  • Menu width
  • Menu colour
  • Menu text size
  • Menu full length or item length
  • Menu text colour
  • Action bar colour
  • Action bar under line colour
  • Action bar corner radius
  • Slide duration
  • Fade alpha shade
  • Action bar text
  • Slide menu button visible(True or false)
Anyway, that's enough of me babbling on, just download the library and let me know what you think about it. The screen shots below were taken on a Galaxy Nexus and a Nexus 7.

This has been tested on:
  • Acer Iconia A500 running Android 4.0.3 Ice Cream Sandwich
  • Samsung Galaxy Nexus running Android 4.2.2 Jelly Bean
  • ASUS Nexus 7(2012) running Android 4.2.2 Jelly Bean
  • LG Nexus 4 running Android 4.4.2 KitKat
  • LG Nexus 5 running Android 4.4.2 KitKat
  • ASUS Nexus 7(2013) running Android 4.4.2 KitKat
This works best in Android 4.0 and above. The attached APK install file has an TabHost with my Sliding Menu on top.

Cheers :cool:

- UPDATED V1.2, Removed the NFC Foreground Library.
- UPDATED V1.3, SDK checker and some other small updates.
- UPDATED V1.31, Added full length or item length vertical menu setting (MenuFullLength = True/False).
- UPDATED V1.32, Added the option to show or hide the top slide menu button (ShowSlideButton = True/False)
- UPDATED V1.34, Added method to show sliding menu
- UPDATED V1.35, Removed pnl_v_shadow.9.png, developers were not adding the file to their projects, thus causing an error

Last updated on 8th June 2015, see V1.35 update note above.
 

Attachments

  • Phone_L.png
    Phone_L.png
    25.6 KB · Views: 4,276
  • Phone_P.png
    Phone_P.png
    34.9 KB · Views: 4,304
  • Tablet_L.png
    Tablet_L.png
    22.7 KB · Views: 3,742
  • Tablet_P.png
    Tablet_P.png
    22.4 KB · Views: 3,624
  • ExtraLiberiesUsed.zip
    6 KB · Views: 2,328
  • SS_SlidingMenuLibraryV1.35.zip
    7 KB · Views: 2,047
  • TestSlidingMenu.zip
    22.6 KB · Views: 2,008
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
Hello,
This is something that I will include in the near future. But at the moment I've got a large asp.net project I'm working on and I've not touched B4A in well over a month. I will add it shortly as an switchable option.

Now it's time to continue with my VS 2012 work.

Cheers...
 

grant1842

Active Member
Licensed User
Longtime User
Great Job .
And chance an option for the menu button to be moved over to the right so it is in Full view.
I have a protective case for my phone and the half image is hard to press.
THanks and great job.
 

NINlol

Member
Licensed User
Longtime User
Hello Peter,

Could you create an option so you only have the sliding menu without the action button on the top?

Thank you
 

Richard Goh

Active Member
Licensed User
Longtime User
Hi Peter,
It is a good library. I also agreed with NINlol suggestion to have an option to hide the menu title bar and the action button.
I had a question on the linrary that how can i change the color on the sliding menu when scroll it? i did a change on the MenuColor to Colors.Red. It does shown the read color when menu is swiped open. But the color doesn't changed on when I tried to scroll the menu. It's shown in original color (grey). Is there a way to change the menu color during scrolling as well?
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello @Richard Goh and @NINlol.
As requested I've quickly added the option to show or hide the top sliding menu button. Please download the latest library V1.32 and replace V1.31 on your machines. I've also updated the demo code attached to this post.

You will need to add the following line as a declaration to your Process_Globals(if that's where you kept the menu variables).
B4X:
Dim ShowSlideButton As Boolean = False

You will also need to modify the SlidingMenu.InitializeActionBar by adding the ShowSlideButton variable at the end.
B4X:
SlidingMenu.InitializeActionBar(Activity, ActBarcolor, ActbarLineColor, AcrBarCornerRadius, ShowSlideButton)

There you have it. You can now switch the top sliding menu button on and off at will.

Enjoy :cool:
 
Last edited:

Richard Goh

Active Member
Licensed User
Longtime User
Hi! Peter,
Thanks for the quick fixed. Great job. Btw, did you encountered that the menu color doesn't change when scrolling if we changed to other color. It's still remain gray during menu scrolling time. Can you provide additional option to change the scrolling color as well? That's will be great if can. I tried to change the menu color to red in Process_Global declaration as below.

Dim MenuColorAsInt = Colors.Red 'Colors.DarGray
 

Nickelgrass

Active Member
Licensed User
Longtime User
Hello Peter,
great lib, just what I was looking for. (Would it be possible to also choose the ActionbarTextColor?) I need a white actionbar and the light gray text is a bit hard to see. Can I contact you by email via www.simplyinvoice.co.uk?
Regards

Edit: Just found out about the TextColor.
 

billyrudi

Active Member
Licensed User
Longtime User
Hi,
can you add a function tu show and hide the menu from code?
SlidingMenu.Show
SlidingMenu.Hide

regards Paolo
 

Russ

Member
Licensed User
Longtime User
Hello,

This is great thank you. Is it possible to remove the actionbar entirely and then set the top value for the slide out menu please? I would just like to use the flyout element.

Thanks for your time!
 

jah

New Member
Licensed User
Longtime User
Hello,

This is great thank you. Is it possible to remove the actionbar entirely and then set the top value for the slide out menu please? I would just like to use the flyout element.

Thanks for your time!

Not sure if this is what you're looking for but using the sample code provided I made the actionbar transparent:

Dim ActBarcolor As Int = Colors.ARGB(0, 0, 0, 0)
Dim ActbarLineColor As Int = Colors.Transparent


And also got rid of the actionbar text in the BuildMenu sub.

Hope that helps.
 

wildfandango

Member
Licensed User
Longtime User
Hi Peter...

First of all thx for sharing this great library...

The method SlidingMenu.MenuHide hide (with animation the menu)

there exist a SlidingMenu.MenuShow or another way to show (with animation to)??

Thx for all
 
Top