xml里配置
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/id_swipe_ly"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</android.support.v4.widget.SwipeRefreshLayout>
SwipeRefreshLayout id_swipe_ly = (SwipeRefreshLayout) findViewById(R.id.id_swipe_ly);id_swipe_ly.setOnRefreshListener(this);
实现SwipeRefreshLayout.OnRefreshListener监听
public void onRefresh() {
id_swipe_ly.setRefreshing(false);
}
执行刷新时的操作