[英]How to animate a View to hide underneath another view, and then animate from that View
我有两个网格视图,我想为其创建自定义动画。 想象一下这个布局:
___________________________________________ | | | | | TOP Grid | | | |_________________________________________| | | | | | BOTTOM | | Grid | | | |_________________________________________|
底部网格将在顶部网格后面“滑出”和“滑动”。 我想我应该使用翻译动画。 如何找出fromX和fromY值? 我以为我可以同时在布局中查看,然后将动画设置为RelativeToParent。
这是正确的方法吗? 如果您知道任何地方我可以找到此功能的源代码,我将非常感激。 谢谢,
试试这个slide-out
和slide-in
动画。
slide-top-in.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" android:fromYDelta="0" android:toYDelta="-100%p" android:duration="1000" /> </set>
slide-top-out.xml
<translate xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" android:fromYDelta="-100%p" android:toYDelta="0" android:duration="1000" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.