+ 2

xml animations

Hi! I got two animations. One I want to show one time and the other one infinite... It's probably easy, but I don't know how to do that... That's my xml-file: <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> Todo: RUN one time: <item android:drawable="@drawable/animation_1_1" android:duration="100"/> <item android:drawable="@drawable/animation_1_2" android:duration="100"/> <item android:drawable="@drawable/animation_1_3" android:duration="100"/> <item android:drawable="@drawable/animation_1_4" android:duration="100"/> stop Todo: RUN Infinite: <item android:drawable="@drawable/animation_2_1" android:duration="100"/> <item android:drawable="@drawable/animation_2_1" android:duration="100"/> <item android:drawable="@drawable/animation_2_1" android:duration="100"/> <item android:drawable="@drawable/animation_2_1" android:duration="100"/> </animation-list>

9th Nov 2020, 11:44 AM
Fu Foy
Fu Foy - avatar
1 ответ
+ 5
Animation animation=AnimationUtils.loadAnimation(getApplicationContex(),R.anim.your_anim); //Run only one time animation.setRepeatCount(1); Your view.startAnimation(animation); //Run infinite animation.setRepeatCount(Animation.INFINITE); Your view.startAnimation(animation); hint: also can be done through xml, Android:repeatCount="infinite".
9th Nov 2020, 4:50 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar