Android - Animate a View's topMargin/bottomMargin/etc in LinearLayout or RelativeLayout

后端 未结 5 2145
被撕碎了的回忆
被撕碎了的回忆 2020-12-25 08:24

I am trying to create a menu that slides up from the bottom. It starts with the menu\'s view just visible at the bottom of the screen, and then clicking it causes it to sli

5条回答
  •  無奈伤痛
    2020-12-25 08:57

    My solution was to create two LinearLayouts, one in it's up state (set to gone) and the other in the menu's down state. Then when the user clicks on the button to slide the menu up, I call a TranslateAnimation showing the menu slide up. I put a listener on the animation that causes the up state to be visible and the down state to be gone when the animation finishes. I reversed this for the "closing" action.

    Not exactly the way I had originally imagined doing it, but it worked.

提交回复
热议问题