一.概述:
SwipeRefreshLayout意思为下拉刷新的布局,其继承ViewGroup,Google在android5.0中提供的下拉刷新控件,且提供了v4支持包。
这是一个容器布局,将listView或SCrollView放入这个容器布局中即可实现下拉刷新的效果。有效的将下拉刷新控件与展示内容的控件实现了分离。这种实现思想非常值得学习。
我将封装到BaseFragment中,在frangment直接调用方法即可,下面是ListView连用说明SwipeRefreshLayout的使用步骤。
二.使用步骤:
佳姝1:首先会先在布局中添加SwipeRefreshLayout控件
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_fresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/lv_template"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="14dp"
android:divider="@color/contain