Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lottie animation has large padding. How to resize the animation to the view, by removing the padding

I have a lottie animation file and when I put it in a view it becomes too small because of the file's internal padding. So I have used lottie_scale attribute in xml, and Also LottieComposition as mentioned in some resources like this but none were successful.

Is there any solution?

like image 349
Ali Has Avatar asked Feb 14 '19 17:02

Ali Has


1 Answers

I think there are two "semi"-solutions right now:

  1. install Bodymovin on Adobe After Effects, then import the animation and set its scale to e.g. 500%.
  2. Scale the Lottie animation view not by Lottie scale, but by using ScaleX, ScaleY:

XML:

android:scaleX="5"
android:scaleY="5"

Programmatically:

view.setScaleX(5f);
view.setScaleY(5f);
like image 130
Ali Has Avatar answered Oct 31 '22 23:10

Ali Has