Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase the lottie "LottieAnimationView" dimensions?

I am using Lottie for animations. The problem is lottie view dimensions are too small. is there a way to customize dimensions in lottie?

like image 547
Vivek Solanki Avatar asked Apr 02 '17 19:04

Vivek Solanki


2 Answers

I tried @Sijansd answer, However LottieComposition.Factory is deprecated now. So I thought to try with scaling the view. This is what I did to make it work. (Tested and 100% working)

android:scaleType="fitXY"

So the final code looks like this

<com.airbnb.lottie.LottieAnimationView
            android:id="@+id/lottie_view"
            android:layout_width="200dp"
            android:scaleType="fitXY"
            android:layout_height="30dp"
            android:layout_gravity="center"
            app:lottie_autoPlay="true"
            app:lottie_fileName="animation.json"
            app:lottie_loop="true" />
like image 94
Vijay E Avatar answered Oct 01 '22 08:10

Vijay E


Try Using animation.setScale(0.4f);

0.1f being the smallest.

like image 28
Mohd Sohail Ahmed Avatar answered Oct 01 '22 09:10

Mohd Sohail Ahmed