问题
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