Shift the screen to right on click of menu; like facebook

限于喜欢 提交于 2019-12-03 06:25:52

问题


In my application, I want to have behavior like facebook app wherein on click of icon I'd like to shift the whole screen towards right and display some menus on the left as shown below:

Before Clicking Menu Button

After Clicking Menu Button

One way is to have a layout with those menu in black color and set its visibility to gone

But in that case, the shifting animation won't be there like it is there in facebook. So is there any way we can do this?


回答1:


This UI Pattern is currently being referred to as Side Navigation and discussed in some detail here:

http://www.androiduipatterns.com/2012/06/emerging-ui-pattern-side-navigation.html

The article also links to several projects that have implemented this navigation:

https://github.com/korovyansk/android-fb-like-slideout-navigation

https://github.com/darvds/RibbonMenu

https://bitbucket.org/jfeinstein10/slidingmenu/overview

https://github.com/Gregadeaux/android-fly-in-app-navigation

It is worth reading the article for its discussion about the issues with this kind of navigation also, though.




回答2:


I have not implemented it but give you an exact idea that you have to use fragment for this. Go through this link




回答3:


This is the best that I've found https://github.com/DWorkS/ActionBarToggle because it's implementation is similar to DrawerLayout from google using ActionBarToggle. Although, it has a problem with open method but I wrote to its owner and he said that he will solve.



来源:https://stackoverflow.com/questions/11222652/shift-the-screen-to-right-on-click-of-menu-like-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!