-2

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.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • If you know how to use external libraries, then check out [Yoyo](https://github.com/daimajia/AndroidViewAnimations) – Giddy Naya Aug 01 '19 at 17:11

1 Answers1

0

You should use 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'. (Example)

Chrisvin Jem
  • 3,940
  • 1
  • 8
  • 24