Android实现了下拉刷新的自定义布局: CircleRefreshLayout
jopen
9年前
一个实现了下拉刷新的自定义布局,动画效果不错。
使用说明:
动画的灵感来自于: https://dribbble.com/shots/1797373-Pull-Down-To-Refresh 。
<com.tuesda.walker.circlerefresh.CircleRefreshLayout xmlns:app="http://schemas.android.com/apk/res-auto" app:AniBackColor="#ff8b90af" app:AniForeColor="#ffffffff" app:CircleSmaller="6" android:id="@+id/refresh_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:background="#ffffffff" android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent"> </ListView> </com.tuesda.walker.circlerefresh.CircleRefreshLayout>
在刷新开始和完成的时候回调:
mRefreshLayout.setOnRefreshListener( new CircleRefreshLayout.OnCircleRefreshListener() { @Override public void refreshing() { // do something when refresh starts } @Override public void completeRefresh() { // do something when refresh complete } });
在刷新完成的时候(比如,图片加载完成),你可以触发:
mRefreshLayout.finishRefreshing();