I am totally new to android, i am trying to implement Sliding Menu having ListView with
Swipe Gesture
, by some searching i found that https://github.com/jfeinstein10/SlidingMenu
is exactly what i want,
There are many questions related to this which are guiding how integrate this library with project, but none of them are for new person like me. also procedure given on github is not detailed, all i know is how to add .jar file but this .zip and other things are totally new for me
This is what i have done till yet;
Now it is showing me many error in package library.src.com.slidingmenu.lib.app
e.g
The declared package "com.slidingmenu.lib.app" does not match the expected package "library.src.com.slidingmenu.lib.app"
now i don't know what to do...
please somebody guide me with proper detailed procedure of how to integrate and use this library in project.
Thanks !
Well, spending 3 days with same problem I found the exact procedure for this thing. The guide on github is of-course not for entry level guys like us, also there is no such a "step-by-step tutorial" for this, so it took time.
Important: I didn't include "Sherlock ActionBar
" library, because I want to keep it simple
First up all update your eclipse to latest ADT
or best way you can download this ADT Bundle
, and confirm that everything is running fine in new ADTBundle
.
Download latest "zip for jfeinstein10 / SlidingMenu" from "gitHub", And extract it anywhere you want. After extraction it must have these files and folders inside.
File -> Import -> Android -> Existing Android Code Into Workspace
, Browse to your folder most probably "SlidingMenu-master
" and you should see following Hit Finish
, If eclipse shows some error like Unable to resolve target
then change your target through Right Click on project -> Properties -> Android
and check any latest google API
your SDK have.
Add Dependency
, by right clicking on project -> properties -> android -> library -> add -> SlidingMenuActivity
, and clear both projects.
Add new XML layout named as menu_frame
in your res -> layout
and put following in it
Put Frame Layout
and list view
in it.
Also add a ListView
in your mainActivity
XML file.
Now it is time to create "Menu" write following code in your onCreate()
after setContentView(R.layout.activity_main)
.
SlidingMenu menu;
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidth(5);
menu.setFadeDegree(0.0f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setBehindWidth(200);
menu.setMenu(R.layout.menu_frame);
At the lines it is showing error press ctrl+1
and import com.slidingmenu.lib.SlidingMenu;
"
Run your project and you should see menu coming out from left side
Now the next task is to add adapter
and listener
for both of your ListViews (i.e for Main-screen and Menu).
For information about function used while creating Menu you can refer to example apps provided with library or google them, there is lot of info available.
Also thanks to "Jeremy Feinstein" for such a great library
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With