Issue #383
Right click res -> New -> Android Resource Directory
, select anim
and name it anim
Right click res/anim -> New -> Android Resource file
, name it bounce
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="0"
android:toYDelta="-100"
android:repeatCount="infinite" />
</set>
We have to set repeatCount
in xml, setting in code does not work !!
val bounce = AnimationUtils.loadAnimation(context, R.anim.bounce)
bounce.repeatMode = Animation.REVERSE
bounce.duration = (1000..2000).random().toLong()
imageView.startAnimation(bounce)