first of all click on the link -ClickMe
Above link is for Lottie official Github page you can read more about it in the above link.
The process to implement it-
1. Migrate your project to AndroidX if you are working with an old project or old version of Android Studio.
2. Add below lines o your app-level Gradle file.
3. After that right-click on res and choose show in explorer option and create the new folder name
assets
5. Now go on this link -ClickMe
6.choose what animation you want to show and download the JSON file of animation.
7.keep downloaded JSON file in the asset folder and then make a layout like below
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@drawable/splash" | |
tools:context=".Splash"> | |
<ImageView | |
android:layout_width="190dp" | |
android:layout_height="60dp" app:srcCompat="@drawable/logo" | |
android:id="@+id/imageView" android:layout_marginTop="256dp" | |
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintHorizontal_bias="0.497"/> | |
<com.airbnb.lottie.LottieAnimationView | |
android:id="@+id/animationView" | |
android:layout_width="180dp" | |
android:layout_height="40dp" | |
app:lottie_autoPlay="true" | |
app:lottie_fileName="stars.json" | |
android:foregroundGravity="center" | |
app:lottie_loop="true" android:layout_marginTop="25dp" | |
app:layout_constraintTop_toBottomOf="@+id/imageView" android:layout_marginEnd="8dp" | |
app:layout_constraintEnd_toEndOf="parent" android:layout_marginStart="8dp" | |
app:layout_constraintStart_toStartOf="parent"/> | |
</androidx.constraintlayout.widget.ConstraintLayout> |
if you have any problem in this you can download full Source Code from below link.
Source Code-ClickMe
0 Comments