美文网首页
Android-SmartRefreshLayout修改Clas

Android-SmartRefreshLayout修改Clas

作者: 请叫我大帅666 | 来源:发表于2023-10-07 17:02 被阅读0次

    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))
    

    底部刷新同理

    相关文章

      网友评论

          本文标题:Android-SmartRefreshLayout修改Clas

          本文链接:https://www.haomeiwen.com/subject/rvlvbdtx.html