Skip to content

linuxjava/HorizontalRefreshLayout

Repository files navigation

🏃HorizontalRefreshLayout-Android🏃

开发者使用 HorizontalRefreshLayout-Android 可以对RecycView、Listview、ScrollView等控件实现左右刷新

APK下载

Download

Demo使用

运行demo需删除gradle.properties中的代理

systemProp.http.proxyHost=dev-proxy.oa.com systemProp.http.proxyPort=8080 systemProp.https.proxyHost=dev-proxy.oa.com systemProp.https.proxyPort=8080

Gradle配置

compile 'xiao.free.horizontalrefreshlayout:lib:v0.1.2'

XML配置

<xiao.free.horizontalrefreshlayout.HorizontalRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/refresh"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@color/blue"> <com.lsjwzh.widget.recyclerviewpager.RecyclerViewPager android:id="@+id/viewpager"android:layout_width="match_parent"android:layout_height="match_parent"android:clipToPadding="false"app:rvp_flingFactor="0.15"app:rvp_singlePageFling="false"app:rvp_triggerOffset="0.5" /> </xiao.free.horizontalrefreshlayout.HorizontalRefreshLayout>

Java代码

refreshLayout = (HorizontalRefreshLayout) findViewById(R.id.refresh); refreshLayout.setRefreshCallback(this); refreshLayout.setRefreshHeader(newLoadingRefreshHeader(this), HorizontalRefreshLayout.LEFT); refreshLayout.setRefreshHeader(newLoadingRefreshHeader(this), HorizontalRefreshLayout.RIGHT);

通过setRefreshHeader方法可以设置左右刷新头部,库中已支持三种刷新效果,如下图所示:

imageimageimage

自定义Header

可通过实现如下接口实现自定义header

publicinterfaceRefreshHeader{/** * @param dragPosition HorizontalRefreshLayout.START or HorizontalRefreshLayout.END */voidonStart(intdragPosition, ViewrefreshHead); /** * @param distance */voidonDragging(floatdistance, floatpercent, ViewrefreshHead); voidonReadyToRelease(ViewrefreshHead); @NonNullViewgetView(ViewGroupcontainer); voidonRefreshing(ViewrefreshHead)}

具体可参考lib库中refreshhead目录中的实现

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages