Android - Change position of android action bar

余生颓废 提交于 2020-01-04 02:38:45

问题


I am trying to build a slide out menu like Facebook and Path apps. I want to place a button on right end of action bar which would trigger opening and closing the menu. When the menu would slide in to make itself visible I want to slide out the main view towards left along with the action bar.

Everything else works fine. I am using the open source code available at - https://github.com/gitgrimbo/android-sliding-menu-demo

But I am not able to find out if I can apply slide animation to the action bar too? If not, designing my own action bar and including in activity layouts is the way to go I believe. I would appreciate any expert guidance in this matter.


回答1:


To the best of my knowledge, this isn't possible. The ActionBar object doesn't inherit from View, so you can't get any of the layout parameters. I believe that it actually resides outside of the window that gets supplied to your activity. So for the effect you're describing, a custom action bar might be in order. Alternatively, you might consider have a transparent/ translucent action bar overlaying your activity, that you show/hide when that panel pops out (as mentioned here) - just a thought, but ultimately do what you feel offers the best UX for your application.



来源:https://stackoverflow.com/questions/10128357/android-change-position-of-android-action-bar

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