A Gmail-like Material Drawer implementation
Based on neokree's MaterialDrawer library. Big thanks to neokree, without him this library would not exist.
- Unlimited Head-Items (Accounts)
- Every Head-Item can have its own Menu
- Head-Item listeners for Avatar or Background taps
- Adding and removing Head-Items and Menu-Items at runtime
- Theming
- Labels
- Normal Sections (with Fragment/Activty start or own onClick listener)
- Bottom-Sections
- Drawer below the toolbar
- Tablet support
- More: Setting your own Fragment on Start, etc
https://github.com/madcyph3r/AdvancedMaterialDrawer/raw/master/example-release.apk
repositories {
maven { url 'http://dl.bintray.com/madcyph3r/maven/' }
}
dependencies {
compile 'de.madcyph3r:materialDrawer:1.1.0@aar'
}
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'
There are 29 examples with explanations how to use the library, here is a small example with one Head-Item. It looks like screenshot three, only in black color.
public class OneHeadItem extends MaterialNavigationDrawer {
MaterialNavigationDrawer drawer = null;
@Override
public int headerType() {
// set type. you get the available constant from MaterialNavigationDrawer class
return MaterialNavigationDrawer.DRAWERHEADER_HEADITEMS;
}
// called from onCreate(), make your view init here or in your fragment.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
MaterialMenu menu = new MaterialMenu();
// first section is loaded
MaterialSection section1 = this.newSection("Section 1", this.getResources().getDrawable(R.drawable.ic_favorite_black_36dp), new FragmentIndex(), false, menu);
MaterialSection section2 = this.newSection("Section 2", this.getResources().getDrawable(R.drawable.ic_list_black_36dp), new FragmentIndex(), false, menu);
// use bitmap and make a circle photo
final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.app_drawer_icon);
final RoundedCornersDrawable drawableAppIcon = new RoundedCornersDrawable(getResources(), bitmap);
// create Head Item
MaterialHeadItem headItem = new MaterialHeadItem(this, "F HeadItem", "F Subtitle", drawableAppIcon, R.drawable.mat5, menu, 0);
// add head Item (menu will be loaded automatically)
this.addHeadItem(headItem);
}
}
- If you've found an issue, look up the open issues and submit a new one if it isn't yet reported.
- If you like the library press the star ;)
- A Wiki with some Introduction will come soon.