1、创建类继承 ClassicsHeader
class RefreshHeader: ClassicsHeader {
constructor(context: Context) : super(context) {
mTextFinish = "已加载完毕"
}
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
}
2、替换xml中的类
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/smartRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.xxx.xxx.ui.refresh.RefreshHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.xxx.xxx.ui.refresh.RefreshFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
3、替换
smartRefreshLayout?.setRefreshHeader(RefreshHeader(context))
底部刷新同理
网友评论