对接lottie时,根据Lottie用法,加载json,效果显示不出来,lottie官网上预览json显示正常,大量搜索后,发现lottie低版本,不适用现在Adobe After Effects和bodymovin插件,重新导出json后,正常显示。
Settings > Advanced > Export Old Json Format
lottie使用方法
1、添加依赖 compile 'com.airbnb.android:lottie:1.2.0'
2、拷贝test.json到app\src\main\assets
3、编写布局引用资源
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieAnimationView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:lottie_fileName="test.json"
app:lottie_loop="true"
app:lottie_autoPlay="true"/>
lottie_fileName 指定json文件路径
lottie_loop 是否循环
lottie_autoPlay 是否自动播放
4、编译运行,查看结果
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)