Question

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.

Était-ce utile?

La solution

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.

Autres conseils

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.

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);

}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top