Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Latest commit

 

History

History
74 lines (61 loc) · 2.55 KB

README_CHN.md

File metadata and controls

74 lines (61 loc) · 2.55 KB

PullLaunchRocket

License Travis Android Arsenal Github Issues

感谢Yalantis为下拉刷新创建了一个炒鸡棒的逻辑案例, 也是PullLaunchRocket的基础.

欢迎各位点个Star给我. 如果你有好的样式, 可以联系我也可以提出PR, 我们一起把它做的更好.

  • 样式一: 发射火箭

rocket

  • 样式二: 太阳升起(仿58同城刷新效果)

rocket

使用

为了更好使用也可参照示例工程sample

  • 在project层级build.gradle中加入
allprojects {
		repositories {
			...
			maven { url "https://jitpack.io" }
		}
	}
  • 在module层级build.gradle中加入
dependencies {
    compile 'com.github.lubeast:PullToRefresh:1.0.1'
}
  • 在布局文件中使用PullToRefreshView
<lumenghz.com.pullrefresh.PullToRefreshView
        android:id="@+id/pull_to_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:lrefresh="rocket"
        >

        <ListView
            android:id="@+id/list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:fadingEdge="none"
            />

</lumenghz.com.pullrefresh.PullToRefreshView>
  • onCreate方法中初始化此View并添加刷新监听
mPullToRefreshView.setOnRefreshListener(new PullToRefreshView.OnRefreshListener() {
    @Override
    public void onRefresh() {
        mPullToRefreshView.postDelayed(new Runnable() {
            @Override
            public void run() {
                mPullToRefreshView.setRefreshing(false);
            }
        }, REFRESH_DELAY);
    }
 });
  • 你可以调用mPullToRefreshView.setRefreshing(boolean isRefreshing);修改刷新状态.