可轻松添加到 RecyclerView 中的自定义动画式拉动刷新功能
可轻松添加到 RecyclerView 中的自定义动画式拉动刷新功能 受到 [dribble 上的这个项目] (https://dribbble.com/shots/2074667-Recipe-Finder-v-2) 的启发
最低 SDK 版本为 16
在您的项目级 build.gradle 中
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}在您的 app 级 build.gradle 中
compile 'com.github.Yalantis:pull-to-make-soup:1.0.2'将该库包含在本地库项目中。 第二步,将 PullToRefreshView 添加到布局中,并设置 app:type="soup"
<com.yalantis.pulltomakesoup.PullToRefreshView
android:id="@+id/pull_to_refresh"
app:type="soup"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:dividerHeight="0dp"
android:fadingEdge="none"/>
</com.yalantis.pulltomakesoup.PullToRefreshView>在 onCreate 方法中,请参考 View 并设置 OnRefreshListener。
mPullToRefreshView = (PullToRefreshView) findViewById(R.id.pull_to_refresh);
mPullToRefreshView.setOnRefreshListener(new PullToRefreshView.OnRefreshListener() {
@Override
public void onRefresh() {}
});当您需要完成刷新呼叫时
mPullToRefreshView.setRefreshing(false);如果需要更改进度状态:
mPullToRefreshView.setRefreshing(boolean isRefreshing)暂无开放 Issues,或尚未同步最近议题。