android-PullRefreshLayout使用
阅读原文时间:2023年07月12日阅读:1

类似与谷歌的SwipeRefreshLayout。但比SwipeRefreshLayout美丽。

用法和SwipeRefreshLayout几乎相同。

在xml中:

1

2

3

4

5

6

<com.baoyz.widget.PullRefreshLayout

android:id=``"@+id/swipeRefreshLayout"

android:layout_width=``"match_parent"

android:layout_height=``"match_parent"``>

<!--&nbsp;ListView、ScrollView、RecyclerView、Other&nbsp;-->

</com.baoyz.widget.PullRefreshLayout>

实例化:

1

2

3

4

5

6

7

8

9

10

PullRefreshLayout&nbsp;layout&nbsp;=&nbsp;(PullRefreshLayout)&nbsp;findViewById(...);

//&nbsp;listen&nbsp;refresh&nbsp;event

layout.setOnRefreshListener(``new PullRefreshLayout.OnRefreshListener()&nbsp;{

@Override

public&nbsp;void&nbsp;onRefresh()&nbsp;{

//&nbsp;start&nbsp;refresh

}

});

//&nbsp;refresh&nbsp;complete

layout.setRefreshing(``false``);

改变刷新样式:

1

layout.setRefreshStyle(PullRefreshLayout.STYLE_CIRCLES);

有三种样式,各自是:CIRCLES、 WATER_DROP 和 RING.

Github下载:https://github.com/baoyongzhang/android-PullRefreshLayout

假设墙不方便:点击下载

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章