Android:使用动画显示/隐藏视图 [英] Android: show/hide a view using an animation
问题描述
我一直在这里浏览许多Google搜索结果/问题,以确定如何通过垂直动画显示/隐藏视图,但是我似乎找不到一个完全正确或不太模糊的视图.
I've been looking through many google results / questions on here to determine how to show/hide a view via a vertical animation, but I can't seem to find one that's exactly right or not too vague.
我有一个布局(撤消栏),该布局在另一个布局之下,在多个其他小部件之上;此撤消栏应根据情况垂直滑动打开和关闭.
I have a layout (undo bar) that's below another layout and above multiple other widgets; this undo bar should vertically slide open and slide closed, depending on the circumstances.
目前,我现在所做的所有操作都是将视图设置为可见或消失.
Currently all I do right now is set the view to be visible or gone.
推荐答案
设置属性
android:animateLayoutChanges="true"
在父布局内.
Set the attribute
android:animateLayoutChanges="true"
inside the parent layout .
如果视图未放置在布局中,则将该视图设置为android:animateLayoutChanges="true"
.
Put the view in a layout if its not and set android:animateLayoutChanges="true"
for that layout.
注意:这仅在API Level 11+(Android 3.0)中有效
NOTE: This works only from API Level 11+ (Android 3.0)
这篇关于Android:使用动画显示/隐藏视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!