[英]How do I add a bounce animation with easing?
I want to add animate a linearlayout to vertically going up and then easing to it's original position.我想为线性布局添加动画以垂直向上然后缓和到它的原始位置。 Like in this .
就像在这个。 However, I only know how to have the linearlayout go up without the easing.
但是,我只知道如何在没有缓动的情况下使线性布局上升。
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="800"
android:fromYDelta="50%p"
/>
</set>
This is the animation xml file that I added for vertically going up.这是我为垂直向上添加的动画xml文件。
You should use overshoot_interpolator
,你应该使用
overshoot_interpolator
,
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/overshoot_interpolator">
<translate
android:duration="800"
android:fromYDelta="50%p"
/>
</set>
If you want more customization, you could run multiple translate animations in sequence.如果您想要更多自定义,您可以按顺序运行多个翻译动画。 You could use android:startOffset to delay the animations and run them 'sequentially'.
您可以使用android:startOffset来延迟动画并“按顺序”运行它们。 ( Example )
(示例)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.