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: 3,852
  • Phone_P.png
    Phone_P.png
    34.9 KB · Views: 3,881
  • Tablet_L.png
    Tablet_L.png
    22.7 KB · Views: 3,334
  • Tablet_P.png
    Tablet_P.png
    22.4 KB · Views: 3,226
  • ExtraLiberiesUsed.zip
    6 KB · Views: 1,981
  • SS_SlidingMenuLibraryV1.35.zip
    7 KB · Views: 1,645
  • TestSlidingMenu.zip
    22.6 KB · Views: 1,640
Last edited:

microbox

Active Member
Licensed User
Longtime User
Hello Peter, thanks for this library. Just want to ask if it's possible to highlight the items when mouse hovers? I'm using odroid device with mouse.
Edited: Also is it possible to show sliding menu after BuildMenu is called?

Best regards,
microbox
 
Last edited:

atulindore

Member
Licensed User
Longtime User
This is a great library ..
any option to add graphics or image in action bar ? as we do have option ActBarText for adding text /title
 

atulindore

Member
Licensed User
Longtime User
Hi Peter
What FadeAlphaShade does in this lib .. Actually I want ActBarText color as original and white .. How can I do this ..
 

William Hunter

Active Member
Licensed User
Longtime User
Hello Peter

I like your Sliding Menu library. Did you ever find the time to add the method to show sliding menu (MenuShow)? Now it's only MenuHide.

Regards :)
 

William Hunter

Active Member
Licensed User
Longtime User
Hello @William Hunter,
Okay I've just uploaded the library to V1.34, I've not tested it but I'm presuming that MenuShow will now work.
Hello Peter - Talk about a quick response! Thank you for that. I tried using the new library in your test app. The only changes made were to replace the earlier library with the newest, and to change all references of SlidingMenu to SlidingMenuStd. When I ran the app I got an error. I tried again by including the Reflection library, but this did not resolve the error. The log is shown below: :eek:
B4X:
** Activity (main) Create, isFirst = true **

java.lang.NoSuchFieldException: pnl_v_shadow

 at java.lang.Class.getDeclaredField(Class.java:890)
 at anywheresoftware.b4a.agraham.reflection.Reflection.GetStaticField(Reflection.java:371)
 at com.simplysoftware.slidingmenustandard.slidingmenustd._vv3(slidingmenustd.java:459)
 at com.simplysoftware.slidingmenustandard.slidingmenustd._initialize(slidingmenustd.java:176)
 at simplysoftware.slidemenu.main._v5(main.java:389)
 at simplysoftware.slidemenu.main._activity_create(main.java:331)
 at java.lang.reflect.Method.invoke(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:372)
 at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
 at simplysoftware.slidemenu.main.afterFirstLayout(main.java:100)
 at simplysoftware.slidemenu.main.access$100(main.java:17)
 at simplysoftware.slidemenu.main$WaitForLayout.run(main.java:78)
 at android.os.Handler.handleCallback(Handler.java:739)
 at android.os.Handler.dispatchMessage(Handler.java:95)

 at android.os.Looper.loop(Looper.java:135)
 at android.app.ActivityThread.main(ActivityThread.java:5257)
 at java.lang.reflect.Method.invoke(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:372)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
java.lang.NoSuchFieldException: pnl_v_shadow
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello @William Hunter, please download the test file in the original post that is called TestSlidingMenu.zip, it has been updated. Please go to the \Objects\res\drawable folder and in that folder and copy the file named pnl_v_shadow.9.png into your \Objects\res\drawable folder, make sure that the file is read only.
 

William Hunter

Active Member
Licensed User
Longtime User
Hello @William Hunter, please download the test file in the original post that is called TestSlidingMenu.zip, it has been updated. Please go to the \Objects\res\drawable folder and in that folder and copy the file named pnl_v_shadow.9.png into your \Objects\res\drawable folder, make sure that the file is read only.
Hello Peter - I used your new TestSlidingMenu app and all is well. I tested both methods MenuShow and MenuHide, and both work very well. I'll try the new library in an app of my own tomorrow, and no doubt it will work just as you have intended. Thank you for sharing your work. It's very much appreciated.

Best regards :)
 

William Hunter

Active Member
Licensed User
Longtime User
@ Peter Simpson – I've been using your library and it works very well. I have observed two behaviors that I would like the ability to change. They are as follows:

1. When using a shortened item length menu, there remains a vertical line as would outline a full length menu.
2. When the menu is in view, the device screen dims.

Is there anyway for me to change these behaviors?

Best regards :)
 
Last edited:

sasidhar

Active Member
Licensed User
Longtime User
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.

Please note: Starting from version 1.34 you will have the add a 9-Patch file called pnl_v_shadow.9.png into your '\Objects\res\drawable' folder, without this file the drawer will cause an error. The file can be found in TestSlidingMenu.zip in the above mentioned folder.

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

Last updated on 20th May 2015, see V1.34 update note above.


Hi,

TestSlidingMenu.zip is damaged unable to extract , can you upload the same.

thanks
 

Jose Luis Barajas

Member
Licensed User
Longtime User
Hi Peter

There is a way to disable the full screen mode using your library?
I Tried changing the settings for not use the entire screen, but in the bottom appears a white region, and no look good.

There is also the way to detect the click event on the status bar, because appears this icon can close the view, and causes confusion

Thanks¡
 

Cassie

Member
Licensed User
Longtime User
Hi Peter,

I got an error on pnl_v_shadow exception in V1.35. I don't know if i missed something.

Thanks
 

Ferbis

Active Member
Licensed User
Longtime User
Hi Peter,

Thanks for this library, I'm trying to run the example and I have the following errors. Any idea, why? Thanks in advance

upload_2015-7-11_0-32-4.png
 

Ferbis

Active Member
Licensed User
Longtime User
Probably the android version is low. Please see attached the AVD that I used. I read that "This works best in Android 4.0 and above" and I thought that Android 4.1.2 it was ok.

upload_2015-7-11_9-16-43.png
 

Derek Johnson

Active Member
Licensed User
Longtime User
Hi Peter,

Thanks for this library, I'm trying to run the example and I have the following errors. Any idea, why? Thanks in advance

View attachment 35812

I'm getting the same errors as yourself, it doesn't matter what device is the target because it is a Compile error. I've tried changing the Target SDK and Min SDK levels in the manifest but I couldn't fix it with that either.

Did you manage to get a workaround for this?

Derek
 

Ferbis

Active Member
Licensed User
Longtime User
I'm getting the same errors as yourself, it doesn't matter what device is the target because it is a Compile error. I've tried changing the Target SDK and Min SDK levels in the manifest but I couldn't fix it with that either.

Did you manage to get a workaround for this?

Derek

No. I gave up. I choosed this library because it was apparently simple to manage but I found this problem and I don't know what to do; so I will wait for a new release with the hope that the problem will disappear :)
 
Top