SwipeRefreshLayout
SwipeRefreshLayout作为谷歌官方推荐的下拉刷新控件,同时简单而又不失优雅的风格,让许多app都使用了这一控件,今天记录下SwipeRefreshLayout在项目中的实际运用。
首先,我们在布局文件中使用:
- 有些人在布局文件中找不到SwipeRefreshLayout
解决方案:升级到androidX 后需要手动在build.gradle中添加新版本的依赖:
implementation “androidx.swiperefreshlayout:swiperefreshlayout:1.0.0”
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>