Android Phoenix Pull-to-Refresh炫酷装逼

For a working implementation, Have a look at the Sample Project - sample
老规矩直接看效果图吧是不是听挺炫酷的!这是官方的一个demo效果!

Android Phoenix Pull-to-Refresh炫酷装逼_第1张图片

Include the library as local library project.
添加Gradle

compile 'com.yalantis:phoenix:1.2.3'

Sync一下ok
Include the PullToRefreshView widget in your layout.
初始化

  PullToRefreshView    mPullToRefreshView;

布局文件

<com.yalantis.phoenix.PullToRefreshView
    android:id="@+id/pull_to_refresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

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

com.yalantis.phoenix.PullToRefreshView>

In your onCreate method refer to the View and setup OnRefreshListener.

mPullToRefreshView = (PullToRefreshView) findViewById(R.id.pull_to_refresh);
mPullToRefreshView.setOnRefreshListener(new PullToRefreshView.OnRefreshListener() {
    @Override
    public void onRefresh() {
        mPullToRefreshView.postDelayed(new Runnable() {
            @Override
            public void run() {
                mPullToRefreshView.setRefreshing(false);
            }
        }, 3000);//3秒刷新
    }
 });

Customization

To customize drawables you can change:

sun.png - Sun image
sky.png - background image
如果您想在自己的app加一个这样的动画请点击这里Android Phoenix Pull-to-Refresh

你可能感兴趣的:(Android基础篇)