A Material Drawer implementation (Like gMail App)
Based on neokree MaterialDrawer (https://github.com/neokree/MaterialNavigationDrawer). Big thanks to neokree, without him this library would not be possible.
- Unlimit Head-Items (Accounts), (see first screenshot, it has 5 Head-Items)
- Every Head-Item can has his own menu
- Head-Item listener for avatar or background click
- Add and remove Head-Items at runtime
- Themeing
- Labels
- Normal Sections (with Fragment/Activty start or own onClick listener)
- Bottom-Sections (see second screenshot)
- and many other things, like set your own fragment on start and so on
https://github.com/madcyph3r/AdvancedMaterialDrawer/raw/master/example-release.apk
repositories {
maven {
url "http://dl.bintray.com/madcyph3r/maven/"
}
}
dependencies {
compile(group: 'de.madcyph3r', name: 'materialDrawer', version: '1.0.5', ext: 'aar')
}
See the example apk and the example code. It has 24 examples with explanations, how to use the library. It's really not difficult. But 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 found an issues, then open a ticket.
- If you like the library, press the star ;)
- A Wiki with small intruductions will come