Android 洛蒂的动画根本就没有播放
我的进口:Android 洛蒂的动画根本就没有播放,android,lottie,lottie-android,Android,Lottie,Lottie Android,我的进口: implementation "com.airbnb.android:lottie:3.2.2" 在我的splash_布局中: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_heigh
implementation "com.airbnb.android:lottie:3.2.2"
在我的splash_布局中:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash"/>
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_width="100dp"
android:layout_height="100dp"
app:lottie_fileName="logo_android.json"
app:lottie_loop="true"
app:lottie_autoPlay="true"
app:lottie_imageAssetsFolder="demo"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
我的图像文件夹位于src/main/res/assets/demo中。logo_android.json文件位于src/main/assets中
这样,动画根本不会显示。没有显示一个图像。我怎样才能让动画工作
编辑:
如果有必要,JSON文件如下所示:
{"v":"5.5.8","fr":25,"ip":0,"op":400,"w":800,"h":400,"nm":"logo_android","ddd":0,"assets":[{"id":"image_0","w":396,"h":51,"u":"images/","p":"img_0.png","e":0},{"id":"image_1","w":122,"h":215,"u":"images/","p":"img_1.png","e":0},(...)
解决了
如果它可以帮助某人,您必须将图像放在src/main/assets/images中
如果它可以帮助某人,您必须将图像放在src/main/assets/images中,以便通过以下方式使其工作:
if(lottieTest.getFrame() == lottieTest.getMaxFrame()) {
lottieTest.setFrame(1);
}
请参阅。通过以下方法使其工作:
if(lottieTest.getFrame() == lottieTest.getMaxFrame()) {
lottieTest.setFrame(1);
}
请参阅。Yo如果您已经在xml中指定了它,则不需要从代码中调用它。我在代码中没有它,但由于它不起作用,我在代码中添加了它以尝试,但也不起作用……json文件中不会有问题吗?请尝试在乐蒂动画网站上播放乐蒂文件中的一些动画?如果是,请尝试为高度和宽度包装内容已尝试使用包装内容,如果您已经在xml中指定了它,则不需要从代码中调用它。我在代码中没有它,但由于它不起作用,我在代码中添加了它以尝试,但也不起作用…json文件中不会有问题吗?请尝试在乐蒂动画网站上播放乐蒂文件中的一些动画?如果是,请尝试对高度和宽度使用“包裹内容”已尝试使用“包裹内容”