Android 烹饪主题的下拉刷新 - pull-to-make-soup
haian
9年前
<p><img src="https://simg.open-open.com/show/f78f30ba63d407ee6ca4331362cd0e76.gif" alt="Android 烹饪主题的下拉刷新 - pull-to-make-soup" width="800" height="600"></p> <h2>要求</h2> <p>Min SDK version 16</p> <h2>使用说明</h2> <p>在布局中添加PullToRefreshView,加上app:type="soup"属性</p> <pre> <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></pre> <p>在onCreate方法中找到view并设置OnRefreshListener</p> <pre> mPullToRefreshView = (PullToRefreshView) findViewById(R.id.pull_to_refresh); mPullToRefreshView.setOnRefreshListener(new PullToRefreshView.OnRefreshListener() { @Override public void onRefresh() {} });</pre> <p>要结束刷新调用</p> <pre> mPullToRefreshView.setRefreshing(false);</pre> <h2>其他</h2> <p>如果要改变加载状态:</p> <pre> mPullToRefreshView.setRefreshing(boolean isRefreshing)</pre> <h2>兼容</h2> <ul> <li>Android JELLY BEAN 4.1+</li> </ul> <p> </p> <p> </p>