<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:layout_width=“match_parent”
android:layout_height=“match_parent”>
<ListView
android:layout_width=“match_parent”
android:layout_height=“match_parent”/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
注意:这一步中,SwipeRefreshLayout必须包裹一个元素,要不然会报如下错误:空指针异常
好了,到这一步你就可以看到下拉刷新的雏形了
API的使用
======
设置下拉刷新进度条颜色
package com.wust.myswiperefresh;
import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.graphics.Color;