您的位置:首页 > 移动开发 > Android开发

Android Phoenix Pull-to-Refresh炫酷装逼

2017-01-04 23:43 246 查看
For a working implementation, Have a look at the Sample Project - sample

老规矩直接看效果图吧是不是听挺炫酷的!这是官方的一个demo效果!



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">

<ListView
android:id="@+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 library