Header Ads

Android Styling ActionBar Sliding Menu

Google has introduced the new Sliding Menu which we can use for Navigation and quick Accessibility. Prior to this release we relied on third party libraries, one of the famous sliding menu library is:
Best examples for the Actionbar sliding menu are googles: Gmail, Youtube, Playstore, Drive etc.
So today will learn how to implement Android’s builtin Actionbar sliding menu.
Here is the official documentation on implementing the Menu:
In this tutorial we will Implement a custom menu not just a simple list, with social sharing options provided at the bottom of sliding menu (refer screenshot).
Also for this tutorial i used the famous thirdparty Actionbar support library: ‘Actionbar Sherlock‘ to support lower versions to API 14
(Library included with the download).
A video demo of the final output of this tutorial:Here are the final screenshots:

td_sliding_menu_img1          td_sliding_menu_img3          td_sliding_menu_img2

Step 1: Create the main layout where your menu and corresponding content resides,
here we use DrawerLayout which holds the content frame and menu:
Note: We just moved the sliding menu to a new file and included in the main layout.
Step 2: Lets jump to sliding menu layout, here we created a custom layout to accomodate the profile and other options. Here’s the final code:
Step 3: Now we have our skeleton ready, lets jump to the implementation. Here is the MainActivity (Code is self explanatory with comments where required):
As an addon for this tutorial, included the profile page where i used a custom Drawable to generate a rounded bitmap.
As a styling factor make the sliding menu a bit transparent to give the translucent effect.
Please share any tips related styling Actionbar sliding menu in the comments.
 Download Sources:

- See more at: http://techiedreams.com/android-styling-actionbar-sliding-menu/#sthash.2wpuheet.dpuf

No comments:

Powered by Blogger.