效果如下:
1.导入依赖
//上拉下拉刷新
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
//工具类
implementation 'com.blankj:utilcode:1.23.2'
2.布局文件
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/act_user_home_iv"
android:layout_width="match_parent"
android:layout_height="400dp"
android:scaleType="centerCrop"
android:src="@drawable/lbjn" />
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/act_user_home_re_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srlAccentColor="#ffffff" />
<androidx.core.widget.NestedScrollView
android:id="@+id/act_user_home_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- 内容区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"