GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing frogermcs.github.io — InstaMaterial concept (part 7) - Navigation Drawer – froger_mcs dev blog – Coding with love {❤️} InstaMaterial concept (part 7) - Navigation DrawerThis post is a part of a series of posts showing Android implementation of INSTAGRAM with Material Design concept. Today we’ll create Navigation Drawer - left sliding panel which shows global application menu. This element is presented between the 32nd and 35th second of the concept video. Also we’ll create DrawerLayoutInstaller - simple tool for injecting DrawerLayout into Activity layout without messing with xml file. The most recent app version is available in Google Play Store Here is the final effect described in today’s post: IntrodutionNavigation Drawer is a very well known design pattern used in Android (and other mobile platforms). It’s a panel that transitions in from the left edge of the screen and displays the app’s main navigation options. Sometimes it transitions in from the right edge, but until you have a good reason for this, it’s rather bad design implementation, which you shouldn’t copy. Navigation Drawer pattern is also well documented (from both - design and programming sides). If you want to deep into design rules just check Navigation Drawer design guide. Also today I won’t write too much about programming this pattern. Instead of this I recommend you to read the official documentation of Creating a Navigation Drawer. In this post, instead of copying the documentation, we’ll prepare DrawerLayoutInstaller - a stub of simple tool, which can help us to configure and inject Navigation Drawer implementationPreparationBefore we start, let’s make some preparation by adding resources, and less meaning boilerplate. First of all we have to add all icons used in app’s menu:
Not each of them looks like on the concept video, but all are taken from the Material Design icons by Google. Our menu is built on top of
Here is the full commit with all new resources. GlobalMenuViewNow let’s prepare layout for our global menu. Basically it’s a simple Requirements for this view are simple - just display options list and user profile. So the implementation isn’t too complicated: As you probably noticed, user profile view is used as ListView’s header. That’s why we have to add custom listener for onClick handling. The rest is pretty straightforward.
Navigation DrawerNow it’s time to create Navigation Drawer implementation. First of all let’s prepare xml root view for our This generic layout can host custom root view (in vContentFrame element) and custom left drawer item (vLeftDrawer element). DrawerLayoutInstallerNow it’s time to prepare our tool for injecting
The first point is done with three simple steps:
Implementation: The rest you can find in full DrawerLayoutInstaller implementation. Finally we can put everything together. Firstly in And the last thing - implement In this case handler delays opening until DrawerLayout closes. Here is the final effect:
That’s all for today. It was super fast and simple, as always it should be. Thanks for reading! 😄 Source codeFull source code of described project is available on Github repository. Author: Miroslaw Stanek If you liked this post, you can share it with your followers or follow me on Twitter!
Written on January 31, 2015
|
| You are visitor 01402894 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |