創建Android抽屜布局的庫:MaterialDrawer
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();
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!