创建Android抽屉布局的库:MaterialDrawer
jopen
10年前
MaterialDrawer库提供了一个快速和简便的Activity来创建和实现抽屉布局。
特性:
- 易于集成
- 快速和简单的api
- modify the colors on the go
- uses the AppCompat support library
- comes with a basetheme which helps if you want an activity with a colored statusbar
- the navigationdrawer is also under the statusbar
- compatible down to API Level 14
截屏
new Drawer() .withActivity(this) .withToolbar(toolbar) .withActionBarDrawerToggle(true) .addDrawerItems( new PrimaryDrawerItem().withName(R.string.drawer_item_home), new PrimaryDrawerItem().withName(R.string.drawer_item_free_play), new PrimaryDrawerItem().withName(R.string.drawer_item_custom), new SpacerDrawerItem(), new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog), new SecondaryDrawerItem().withName(R.string.drawer_item_help).withIcon(FontAwesome.Icon.faw_question).setEnabled(false), new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github), new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(FontAwesome.Icon.faw_bullhorn) ) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) { // do something with the clicked item :D } }) .build();