I want to implement a sliding Menu like FB or G+ app and I have found some sample code from FB Menu Demo and https://github.com/jfeinstein10/SlidingMenu
These are good to begin with, But I need something extra from them. Like here it works only on the click of the menu button but I want to move it by gestures as well. I want to have the behavior that there is a center view and on moving that center towards the right, one view will appear and on moving that towards left, the menu will appear. Say there are three views A,B,C and when I swipe C towards left then A appear and when I swipe C towards right then B appear. C is in the middle of A and B.
1.Middle view moves towards right
Move towards right
2.Move the middle view towards left side
Move towards left
Now my question is: What are the best practices to develop the views like that. I have heard from someone that I should use fragments and View pager as well. So how can I develop this? Is there any sample implementation done by anyone ? Any help and suggestions are appreciated.
For reference see this app which uses this type of sliding b/w views Skout app
The simplest solution may be to use android-undergarment, which has bezel swiping built in, based on the project README:
Another open source library I've found that's been very good is SlidingMenu. It should suit your needs as you can open and close the drawer by a "Menu" click and by bezel swiping. I found integrating this along with an Actionbar library like ActionBarSherlock or johannilsson's android-actionbar library is simply a matter of changing a line or two of code in the library project. The Readme for the SlidingMenu library explains how to integrate with the ABSherlock library.
One thing worth noting is that the SlidingMenu example project demonstrates a number of different drawer open-close animations. These are some of the best animations I've seen for this style of menu/navigation.
There is an Official Way ... useful and light (by use of v4 Support Library):
Creating a Navigation Drawer:
https://developer.android.com/training/implementing-navigation/nav-drawer.html
You can simply use
TranslateAnimation
on the view which you wish to move along with a pop up for fade and another pop up window for you menu. I have implemented it in my application, and it works like a charm.Code:
Hope this would help.