1

I have been searching a lot for like 4 hours how do use this, and had to reset my project as i messed up with the dependencies. Could anyone please explain how do i simply import and solve all the dependencies as i had it once set up but there were errors, i needed to change some lines in gradle file, i also tried to import pom from gradle and resolve all dependencies but it failed in the end.

i would be very thankful to anyone who would post a noob friendly [how-to] use simonvt library in android studio, i bet it would be helpful to others too.

There may be a problem with my java or android studio, thats why i would like to check a way that works for sure, so that if it fails, i have some software problems.


Update

So i set up Android studio and updated all android packages, and checked everything. I found this tutorial on how to use another menu drawer library in android studio: http://androiddev.orkitra.com/?p=72290 but i couldn't get it done as i always get dependency errors.

I am sure it would help me and a lot of other people if someone would post a step by step tutorial on how to import any of these 2 libraries.

Filip Luchianenco
  • 6,912
  • 9
  • 41
  • 63

3 Answers3

7

It's as simple as adding a single line to your build.gradle file:

dependencies {
    compile 'net.simonvt.menudrawer:menudrawer:3.0.+@aar'
    // all the other dependencies
}

You might want to copy some styles and drawables from the sample app. Or create your own drawer style.

flx
  • 14,146
  • 11
  • 55
  • 70
  • what i did is: 1. go to project structure 2. add module (+ button) 3. adding the menudrawer module 4. select my project > dependencies > add dependency > select menudrawer > ok 5. go to build.gradle, add `compile 'net.simonvt.menudrawer:menudrawer:3.0.+@aar'` in `dependencies { compile 'com.android.support:support-v4:13.0.+' }` i was having errors with manifest files, and i made same versions everywhere in both my project and module(minsdk, targetsdk, compilesdk, buildtoolsver) what would be the correct steps to import this project library? – Filip Luchianenco Sep 08 '13 at 10:33
  • 1
    I'm not sure how to do it via android studio's gui. i looks quite redundant. if you just add the support lib and the menudrawer lib in the build.gradle (and then press "reload from gradle"; by default android studio dues this by automatically) it should create dependend modules on it's own. to be clear: you do **not** need to download the library yourself. do **not** put it somewhere in your /libraries folder. – flx Sep 08 '13 at 10:47
  • i don't understand how, but it added itself in the external libraries. For me it sounds without any logic, so i download simonvt library, and then write in gradle this line, and it adds itself from where? i think from internet) i've just got one question for future: how did you make this `net.simonvt.menudrawer:menudrawer:3.0.+@aar` so that i can do this for other libraries too. – Filip Luchianenco Sep 08 '13 at 11:00
  • 1
    it is a maven dependency: http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html – flx Sep 08 '13 at 11:04
0

If all you need is a menu drawer that opens and closes, you dont need all the configurations, and other stuff that come with the library, I would go with Android's DrawerLayout. Its easy to use and you don't have all the headaches and resource overhead that comes with setting up a library project to use in your project.

Jason Crosby
  • 3,533
  • 4
  • 28
  • 49
  • i used it, and did from left to right, but after that i couldn't make the right to left one, that's all i need to do, on both sides. here is my question, if you could help me in adding the right to left panel, i would be very thankful. http://stackoverflow.com/questions/18655357/left-to-right-and-right-to-left-android-sliding-panel – Filip Luchianenco Sep 06 '13 at 18:20
  • @FilipLuch you can configure it to pick which side you want the drawer on and to have 2 drawers one on each side. See http://stackoverflow.com/questions/17861755/drawerlayout-double-drawer-left-and-right-drawers-simultaneously and http://developer.android.com/training/implementing-navigation/nav-drawer.html for information on how to do it. – Jason Crosby Sep 09 '13 at 02:06
0

I have done the following in my code

added following line to build.gradle file

dependencies {
compile 'net.simonvt.menudrawer:menudrawer:3.0.+@aar'
}

in MainActivity.java

 public MenuDrawer menuDrawer;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    menuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY, Position.LEFT, MenuDrawer.MENU_DRAG_CONTENT);
    menuDrawer.setDropShadowEnabled(false);

    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View convertView = inflater.inflate(R.layout.activity_menu_drawer, null);

    menuDrawer.setContentView(R.layout.activity_home);
    menuDrawer.setMenuView(convertView);

}
Kishor N R
  • 1,521
  • 1
  • 17
  • 23