I have implemented drawerlayout which slides from the right but it does not shift the activity the right like facebook does (See below image). How do I push the current activity to the right side when user taps on opendrawer button like in the above image.Currently it appears on top of activity and drops shadow.I really appreciate any help . Thanks in advance.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Although there is no default way to slide the activity along with navigation drawer we can do it through code. As suggested in the above answer by mick88 following is the code snippet from my project.
my profile.xml file
now in Activity
This is really helpful. Put this snippet in your MainActivity.java
To answer your question. The DrawerLayout is behaving as expected.
You can use Slidingmenu (or Umano) in conjunction with a DrawerLayout (I do).
Finally, regarding what you want (and what Facebook does), Google itself doesn't want you to do that. They want you to use the drawer the way they use it in Google Music (for example)
A Google contact said exactly this to me:
So don't do what Facebook does. (That is a good advice in any other context) :)
This is not recommended, but you can move your layout programmatically:
OP got the answer. But for someone else that wants that effect, can use SlidingPaneLayout. It's designed for this purpose.
In XML file:
There are two panes, right and left, stick together and thus move together. For me, the left pane is the main pane and the right is hidden with a toggle icon to display it. (A view with id appBarSearchIcon).
Remember, there is one viewgroup named, SlidingPaneLayout that has just two children, The Left and The Right.
And important part in the activity:
Closing the right pane is done by the API, just like Navigation Drawer.
I don't think you can implement it with the stock
DrawerLayout
, however withSlidingMenu
you can, the GitHub repo here should explain all you need