赞
踩
implementation 'com.airbnb.android:lottie:3.0.1'
<com.airbnb.lottie.LottieAnimationView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:lottie_autoPlay="true"
app:lottie_fileName="AndroidWave.json"
app:lottie_loop="true" />
<com.airbnb.lottie.LottieAnimationView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/colorline" />
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieAnimationViewCodeActivityOne"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@BindView(R.id.lottieAnimationViewCodeActivityOne)
LottieAnimationView lottieAnimationViewCodeActivityOne;
lottieAnimationViewCodeActivityOne.setAnimation("camera.json");
lottieAnimationViewCodeActivityOne.playAnimation();
lottieAnimationViewCodeActivityOne.setRepeatCount(ValueAnimator.INFINITE);
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieAnimationViewCodeActivityTwo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@BindView(R.id.lottieAnimationViewCodeActivityTwo)
LottieAnimationView lottieAnimationViewCodeActivityTwo;
lottieAnimationViewCodeActivityTwo.setAnimation(R.raw.hamburger_arrow);
lottieAnimationViewCodeActivityTwo.playAnimation();
lottieAnimationViewCodeActivityTwo.setRepeatCount(ValueAnimator.INFINITE);
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieCompositionActivityOne"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@BindView(R.id.lottieCompositionActivityOne)
LottieAnimationView lottieCompositionActivityOne;
LottieTask<LottieComposition> lottieCompositionFromAsset = LottieCompositionFactory.fromAsset(this, "emoji_wink.json");
lottieCompositionFromAsset.addListener(result -> {
lottieCompositionActivityOne.setComposition(result);
lottieCompositionActivityOne.playAnimation();
lottieCompositionActivityOne.setRepeatCount(ValueAnimator.INFINITE);
});
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieCompositionActivityTwo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@BindView(R.id.lottieCompositionActivityTwo)
LottieAnimationView lottieCompositionActivityTwo;
LottieTask<LottieComposition> lottieCompositionFromRawRes = LottieCompositionFactory.fromRawRes(this, R.raw.jolly_walker);
lottieCompositionFromRawRes.addListener(result -> {
lottieCompositionActivityTwo.setComposition(result);
lottieCompositionActivityTwo.playAnimation();
lottieCompositionActivityTwo.setRepeatCount(ValueAnimator.INFINITE);
});
日志
java.lang.IllegalStateException: Missing values for keyframe.
日志
java.lang.IllegalStateException: You must set an images folder before loading an image. Set it with LottieComposition#setImagesFolder or LottieDrawable#setImagesFolder
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。