引言:仅作为笔记、demo来源于SmartRefreshLayout 官网、稍作修改、引用地址:SmartRefreshLayout/md_custom.md at master · scwang90/SmartRefreshLayout · GitHub
这里使用 SmartRefreshLayout、以及Lottie两个库(Lottie也可以用svga替换);
先看效果吧!

解释:很简单、上面的动画是个json文件、这个文件被Lottie解析播放就行了、其他按照 SmartRefreshLayout 官网自定义header写就行!
废话不多说、粘出关键代码及目录结构;
1、添加依赖:
// SmartRefreshLayout 刷新框架
implementation 'io.github.scwang90:refresh-layout-kernel:2.0.5'
//Lottie
implementation "com.airbnb.android:lottie:5.2.0"
2、布局文件:

activity_main.xml 代码:
<?xml version="1.0" encoding="utf-8"?>
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/srl"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@android:color/darker_gray"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:co

本文介绍如何结合SmartRefreshLayout刷新框架与Lottie动画库来创建自定义的刷新头动画效果。文中提供了从添加依赖到具体实现步骤的详细代码示例。
最低0.47元/天 解锁文章
2459

被折叠的 条评论
为什么被折叠?



