Actionbar and Navigation drawer - slide Actionbar with Activity/Fragment

KickAss picture KickAss · Aug 31, 2013 · Viewed 21.8k times · Source

I am using a Navigation Drawer as shown here: Android Example. At the moment, the Actionbar is static, it does not move when the Drawer opens/closes (only it's title changes). How can I apply this effect:

Image

I want the entire ActionBar to move with the Sliding fragment. And the Name and Buttons on the ActionBar to remain as they are. Please tell me what code you would need to see.

ALSO, Question 2:

When you're using DrawerLayout you include in the xml the FrameLayout (for the content_frame) and ListView (where you add your navigation settings... In that Drawer, can you modify the layout so that you can add not just ListView but other Views aswell? On top or bottom of the ListView? Something like this:

enter image description here

I want to add ImageView (not hyperlinked, just Image) and Additional TextViews (for instructions) not hyperlinked.

Answer

Omar Farhat picture Omar Farhat · Aug 31, 2013

Consider using SlidingMenu library from GitHub. It's powerfull flexible and also you can do ANYTHING with it. You can slide the actionbar by just simply calling:

setSlidingActionBarEnabled(true);

https://github.com/jfeinstein10/SlidingMenu