'Lottie Animation is too small

I am using a lottie animation in my android app. I downloaded the json file and pasted res/raw. I am using it my app using XML and Java, but when I run the app, its size is very tiny compared to parent because I set width and height to match_parent.

Here is my code

<RelativeLayout

    android:layout_marginTop="@dimen/margin5"
    android:id="@+id/eight_relative"
    app:layout_constraintTop_toBottomOf="@+id/seventh_relative"
    android:layout_width="70dp"
    android:layout_height="50dp">

    <com.airbnb.lottie.LottieAnimationView
        android:scaleType="centerCrop"
        android:id="@+id/disk_encryption_switch"
        android:layout_marginEnd="@dimen/margin30"
        android:layout_alignParentEnd="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:lottie_rawRes="@raw/switch_animation"

        />
</RelativeLayout>

I changed the scale type and padding, but that didn't fix it. How can I make it bigger?



Solution 1:[1]

I know it's bit late, but setting

android:scaleX="2"
android:scaleY="2"

should work just fine.

Surely, you can scale any float value you need instead of 2.

And obviously you may keep only scaleX or scaleY for 1-dimension scaling.

There is also android:scaleType="fitXY" property set with the purpose of equal X/Y scaling, but I guess it's optional in the particular case.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1