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,270
  • Phone_P.png
    Phone_P.png
    34.9 KB · Views: 4,302
  • Tablet_L.png
    Tablet_L.png
    22.7 KB · Views: 3,739
  • Tablet_P.png
    Tablet_P.png
    22.4 KB · Views: 3,619
  • ExtraLiberiesUsed.zip
    6 KB · Views: 2,326
  • SS_SlidingMenuLibraryV1.35.zip
    7 KB · Views: 2,043
  • TestSlidingMenu.zip
    22.6 KB · Views: 2,006
Last edited:

Ferbis

Active Member
Licensed User
Longtime User
Hi Peter, I have been trying to make it work these last days but witout any success. Could you please give me a hint?:eek:
Thanks in advance
 

susu

Well-Known Member
Licensed User
Longtime User
Just delete folder "value-v21" in "\res". It worked for me.
 

susu

Well-Known Member
Licensed User
Longtime User
I noticed a problem with this lib. On Android 5.0, all button view will float over the side menu even you send the button to back. The problem only appears with button view and Android 5.0. It works great on Android 4.1.2 and all other views.
 

Ferbis

Active Member
Licensed User
Longtime User
@susu, I just realized that I dind't say thank you for sharing your discover :)

THANK YOU VERY MUCH!!!!!!!
 

rudystyle

Member
Licensed User
Longtime User
Its a great library. However in Android 5.0+ , the menu is behind the button. Could anyone get the solution?
 

Devv

Active Member
Licensed User
Longtime User
res\values-v21\theme.xml:4: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DarkActionBar'.
res\values-v21\theme.xml:9: error: Error: No resource found that matches the given name: attr 'android:colorAccent'.
res\values-v21\theme.xml:7: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.
res\values-v21\theme.xml:8: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.
 

R0BERT0

Member
Licensed User
Longtime User
I'm testing then example of library in b4a 6.8
But the example crash in this line..



I'm using:
ICSCONTROL 1.0
ANIMATIONPLUS 2.3

Any idea?
thanks.
 

R0BERT0

Member
Licensed User
Longtime User
Thanks for reply.

the example crash in this line
SlidingMenu.AddItem("Item 1", LoadBitmap(File.DirAssets, "7-location-web-site.png"), 1)

This is the error message.

java.lang.RuntimeException: Array not expected...

I'm updating one app with this library... Is easier to me use the same library.
 

Tirecs

Member
Licensed User
Longtime User
Hello Peter,
I use your library in my app and today I downloaded the new version of B4A (7.01). Compiling works fine, but if I want to run my app on my mobile phone the app always crashes when the app tries to create the menu with this message:

B4X:
Logger connected to:  samsung SM-G935F
--------- beginning of main
** Activity (main) Create, isFirst = true **
main_buildmenu (java line: 411)
java.lang.NoSuchMethodError: No virtual method AddTwoLinesAndBitmap2(Ljava/lang/String;Ljava/lang/String;Landroid/graphics/Bitmap;Ljava/lang/Object;)V in class Lanywheresoftware/b4a/objects/ListViewWrapper; or its super classes (declaration of 'anywheresoftware.b4a.objects.ListViewWrapper' appears in /data/app/com.simplysoftware.slidingmenustandard2-1/base.apk)
    at com.simplysoftware.slidingmenustandard.slidingmenustd._additem(slidingmenustd.java:61)
    at com.simplysoftware.slidingmenustandard2.main._buildmenu(main.java:411)
    at com.simplysoftware.slidingmenustandard2.main._activity_create(main.java:353)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at com.simplysoftware.slidingmenustandard2.main.afterFirstLayout(main.java:102)
    at com.simplysoftware.slidingmenustandard2.main.access$000(main.java:17)
    at com.simplysoftware.slidingmenustandard2.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6692)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
main_buildmenu (java line: 411)
java.lang.NoSuchMethodError: No virtual method AddTwoLinesAndBitmap2(Ljava/lang/String;Ljava/lang/String;Landroid/graphics/Bitmap;Ljava/lang/Object;)V in class Lanywheresoftware/b4a/objects/ListViewWrapper; or its super classes (declaration of 'anywheresoftware.b4a.objects.ListViewWrapper' appears in /data/app/com.simplysoftware.slidingmenustandard2-1/base.apk)
    at com.simplysoftware.slidingmenustandard.slidingmenustd._additem(slidingmenustd.java:61)
    at com.simplysoftware.slidingmenustandard2.main._buildmenu(main.java:411)
    at com.simplysoftware.slidingmenustandard2.main._activity_create(main.java:353)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at com.simplysoftware.slidingmenustandard2.main.afterFirstLayout(main.java:102)
    at com.simplysoftware.slidingmenustandard2.main.access$000(main.java:17)
    at com.simplysoftware.slidingmenustandard2.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6692)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

I think the problem is the same like this one: https://www.b4x.com/android/forum/threads/app-crashing-b4a-6-80.76956/
Is it possible that you recompile the library with the new B4A version and upload it again or do I have to use another library if I want to use B4A 7.01 or higher in the future?

Thanks in advance :)
 

Paolo Pini

Member
Licensed User
Longtime User
The example doesn't found the .png image in 'File.DirAssets' and stop, what can I do?
 

MohMor

Member
Hi
I am new to B4A android. your library seems great i think. but I do not know how to use your library.
at first, I added the libraries to the basic-4-android library and then i opened B4A source code. but when i set up B4A bridge, no slider seen. also a lot of error occured.
it seems that there is not any view in the designer.
what should i do.
thank you a lot guys.
 
Top