Lottie-android: setScale doesn't work

Created on 4 Mar 2018  路  2Comments  路  Source: airbnb/lottie-android

I'm trying to execute this code:
animationView.cancelAnimation(); animationView.setAnimation("empty.json"); animationView.setRepeatCount(LottieDrawable.INFINITE); animationView.setScale(1); animationView.playAnimation();

Unfortunatelly, the animation isn't shown if I include the line animationView.setScale(1);. Isn't it possible to change scale at runtime?

The XML File looks like that
<com.airbnb.lottie.LottieAnimationView android:id="@+id/aniMitte" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="24dp" app:layout_constraintBottom_toTopOf="@+id/lblCenterText" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:lottie_autoPlay="true" app:lottie_fileName="loading.json" app:lottie_loop="true" app:lottie_scale="2" />

Most helpful comment

you should set your LottieAnimationView wrapcontent then setScale take effect

All 2 comments

@Philipp97714 This is most likely due to your ConstraintLayout constraints causing the view to remain a certain size. Try adjusting your constraints or as a test, try setting a different image drawable on the LottieAnimationView (it extends ImageView so you can use it like you would anything other ImageView).
If you can't figure it out, attach a sample project.

you should set your LottieAnimationView wrapcontent then setScale take effect

Was this page helpful?
0 / 5 - 0 ratings

Related issues

11hhlin1 picture 11hhlin1  路  3Comments

anitoledo picture anitoledo  路  4Comments

gpeal picture gpeal  路  5Comments

dpmaycry picture dpmaycry  路  3Comments

addyi picture addyi  路  3Comments