依赖
dependencies {
implementation 'com.airbnb.android:lottie:3.3.0'
}
使用
lottieAnimationView.setImageAssetsFolder("images");
lottieAnimationView.setAnimation("data.json");
lottieAnimationView.loop(true);//过时
lottieAnimationView.playAnimation();
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieAnimationView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:lottie_fileName="hello-world.json"
app:lottie_loop="true"
app:lottie_autoPlay="true" />
问题:
在把lottie加到flipView的时候发生了fragment空指针异常的错误,发生错误的原因暂时没有找到。