# SmartRefreshLayout

public class SmartRefreshLayout

## Constructors

SmartRefreshLayout
Link copied to clipboard
public void SmartRefreshLayout(Context context)
public void SmartRefreshLayout(Context context, AttributeSet attrs)

## Types

LayoutParams
Link copied to clipboard
public class LayoutParams
RefreshKernelImpl
Link copied to clipboard
public class RefreshKernelImpl
刷新布局核心功能接口 为功能复杂的 Header 或者 Footer 开放的接口

## Functions

autoLoadMore
Link copied to clipboard
public boolean autoLoadMore()
Display load more animation and trigger load more event.
public boolean autoLoadMore(int delayed)
public boolean autoLoadMore(int delayed, int duration, float dragRate, boolean animationOnly)
Display load more animation and trigger load more event, Delayed start.
autoLoadMoreAnimationOnly
Link copied to clipboard
public boolean autoLoadMoreAnimationOnly()
Display load more animation without triggering events.
autoRefresh
Link copied to clipboard
public boolean autoRefresh()
Display refresh animation and trigger refresh event.
public boolean autoRefresh(int delayed)
Display refresh animation and trigger refresh event, Delayed start.
public boolean autoRefresh(int delayed, int duration, float dragRate, boolean animationOnly)
Display refresh animation, Multifunction.
autoRefreshAnimationOnly
Link copied to clipboard
public boolean autoRefreshAnimationOnly()
Display refresh animation without triggering events.
closeHeaderOrFooter
Link copied to clipboard
public RefreshLayout closeHeaderOrFooter()
Close the Header or Footer, can't replace finishRefresh and finishLoadMore.
computeScroll
Link copied to clipboard
public void computeScroll()
重写 computeScroll 来完成 smart 的特定功能 1.越界回弹 2.
dispatchTouchEvent
Link copied to clipboard
public boolean dispatchTouchEvent(MotionEvent e)
事件分发 （手势核心） 1.多点触摸 2.
finishLoadMore
Link copied to clipboard
public RefreshLayout finishLoadMore()
public RefreshLayout finishLoadMore(boolean success)
public RefreshLayout finishLoadMore(int delayed)
public RefreshLayout finishLoadMore(int delayed, boolean success, boolean noMoreData)
finish load more.
finishLoadMoreWithNoMoreData
Link copied to clipboard
public RefreshLayout finishLoadMoreWithNoMoreData()
finish load more with no more data.
finishRefresh
Link copied to clipboard
public RefreshLayout finishRefresh()
public RefreshLayout finishRefresh(boolean success)
public RefreshLayout finishRefresh(int delayed)
public RefreshLayout finishRefresh(int delayed, boolean success, Boolean noMoreData)
finish refresh.
finishRefreshWithNoMoreData
Link copied to clipboard
public RefreshLayout finishRefreshWithNoMoreData()
finish load more with no more data.
generateLayoutParams
Link copied to clipboard
public LayoutParams generateLayoutParams(AttributeSet attrs)
getLayout
Link copied to clipboard
public ViewGroup getLayout()
Get the ViewGroup of RefreshLayout 获取实体布局视图
getNestedScrollAxes
Link copied to clipboard
public int getNestedScrollAxes()
getRefreshFooter
Link copied to clipboard
public RefreshFooter getRefreshFooter()
Get footer of RefreshLayout 获取当前 Footer
getRefreshHeader
Link copied to clipboard
public RefreshHeader getRefreshHeader()
Get header of RefreshLayout 获取当前 Header
getState
Link copied to clipboard
public RefreshState getState()
Get the current state of RefreshLayout 获取当前状态
isLoading
Link copied to clipboard
public boolean isLoading()
是否正在加载
isNestedScrollingEnabled
Link copied to clipboard
public boolean isNestedScrollingEnabled()
isRefreshing
Link copied to clipboard
public boolean isRefreshing()
是否正在刷新
onNestedFling
Link copied to clipboard
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed)
onNestedPreFling
Link copied to clipboard
public boolean onNestedPreFling(View target, float velocityX, float velocityY)
onNestedPreScroll
Link copied to clipboard
public void onNestedPreScroll(View target, int dx, int dy, Array<int> consumed)
onNestedScroll
Link copied to clipboard
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
onNestedScrollAccepted
Link copied to clipboard
public void onNestedScrollAccepted(View child, View target, int axes)
onStartNestedScroll
Link copied to clipboard
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes)
onStopNestedScroll
Link copied to clipboard
public void onStopNestedScroll(View target)
performClick
Link copied to clipboard
public boolean performClick()
requestDisallowInterceptTouchEvent
Link copied to clipboard
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept)
这段代码来自谷歌官方的 SwipeRefreshLayout 主要是为了让老版本的 ListView 能平滑的下拉 而选择性的屏蔽 requestDisallowInterceptTouchEvent 应用场景已经在英文注释中解释清楚，大部分第三方下拉刷新库都保留了这段代码，本库也不例外
resetNoMoreData
Link copied to clipboard
public RefreshLayout resetNoMoreData()
Restore the original state after finishLoadMoreWithNoMoreData.
setDefaultRefreshFooterCreator
Link copied to clipboard
public static void setDefaultRefreshFooterCreator(DefaultRefreshFooterCreator creator)
设置默认 Footer 构建器
setDefaultRefreshHeaderCreator
Link copied to clipboard
public static void setDefaultRefreshHeaderCreator(DefaultRefreshHeaderCreator creator)
设置默认 Header 构建器
setDefaultRefreshInitializer
Link copied to clipboard
public static void setDefaultRefreshInitializer(DefaultRefreshInitializer initializer)
设置默认 Refresh 初始化器
setDisableContentWhenLoading
Link copied to clipboard
public RefreshLayout setDisableContentWhenLoading(boolean disable)
Set whether to enable the action content view when loading.
setDisableContentWhenRefresh
Link copied to clipboard
public RefreshLayout setDisableContentWhenRefresh(boolean disable)
Set whether to enable the action content view when refreshing.
setDragRate
Link copied to clipboard
public RefreshLayout setDragRate(float rate)
Set the damping effect.
setEnableAutoLoadMore
Link copied to clipboard
public RefreshLayout setEnableAutoLoadMore(boolean enabled)
Sets whether to listen for the list to trigger a load event when scrolling to the bottom (default true).
setEnableClipFooterWhenFixedBehind
Link copied to clipboard
public RefreshLayout setEnableClipFooterWhenFixedBehind(boolean enabled)
Set whether to clip footer when the Footer is in the FixedBehind state.
setEnableClipHeaderWhenFixedBehind
Link copied to clipboard
public RefreshLayout setEnableClipHeaderWhenFixedBehind(boolean enabled)
Set whether to clip header when the Header is in the FixedBehind state.
setEnableFooterFollowWhenNoMoreData
Link copied to clipboard
public RefreshLayout setEnableFooterFollowWhenNoMoreData(boolean enabled)
Set whether or not Footer follows the content after there is no more data.
setEnableFooterTranslationContent
Link copied to clipboard
public RefreshLayout setEnableFooterTranslationContent(boolean enabled)
Set whether to pull up the content while pulling up the header.
setEnableHeaderTranslationContent
Link copied to clipboard
public RefreshLayout setEnableHeaderTranslationContent(boolean enabled)
Whether to enable pull-down refresh (enabled by default).
setEnableLoadMore
Link copied to clipboard
public RefreshLayout setEnableLoadMore(boolean enabled)
Set whether to enable pull-up loading more (enabled by default).
setEnableLoadMoreWhenContentNotFull
Link copied to clipboard
public RefreshLayout setEnableLoadMoreWhenContentNotFull(boolean enabled)
Set whether to pull up and load more when the content is not full of one page.
setEnableNestedScroll
Link copied to clipboard
public RefreshLayout setEnableNestedScroll(boolean enabled)
Setting whether nesting scrolling is enabled (default off + smart on).
setEnableOverScrollBounce
Link copied to clipboard
public RefreshLayout setEnableOverScrollBounce(boolean enabled)
Set whether to enable cross-border rebound function.
setEnableOverScrollDrag
Link copied to clipboard
public RefreshLayout setEnableOverScrollDrag(boolean enabled)
Set whether to enable cross-border drag (imitation iphone effect).
setEnablePureScrollMode
Link copied to clipboard
public RefreshLayout setEnablePureScrollMode(boolean enabled)
Set whether to enable the pure scroll mode.
setEnableRefresh
Link copied to clipboard
public RefreshLayout setEnableRefresh(boolean enabled)
是否启用下拉刷新（默认启用）
setEnableScrollContentWhenLoaded
Link copied to clipboard
public RefreshLayout setEnableScrollContentWhenLoaded(boolean enabled)
Set whether to scroll the content to display new data after loading more complete.
setEnableScrollContentWhenRefreshed
Link copied to clipboard
public RefreshLayout setEnableScrollContentWhenRefreshed(boolean enabled)
Set whether to scroll the content to display new data after the refresh is complete.
setFixedFooterViewId
Link copied to clipboard
public RefreshLayout setFixedFooterViewId(int id)
设置固定在 Footer 上方的视图Id，可以在 Header 上下滚动的时候保持不跟谁滚动
setFixedHeaderViewId
Link copied to clipboard
public RefreshLayout setFixedHeaderViewId(int id)
设置固定在 Header 下方的视图Id，可以在 Footer 上下滚动的时候保持不跟谁滚动
setFooterHeight
Link copied to clipboard
public RefreshLayout setFooterHeight(float heightDp)
Set the Footer's height.
setFooterHeightPx
Link copied to clipboard
public RefreshLayout setFooterHeightPx(int height)
设置 Footer 高度
setFooterInsetStart
Link copied to clipboard
public RefreshLayout setFooterInsetStart(float insetDp)
Set the Footer's start offset.
setFooterInsetStartPx
Link copied to clipboard
public RefreshLayout setFooterInsetStartPx(int insetPx)
Set the Footer's start offset.
setFooterMaxDragRate
Link copied to clipboard
public RefreshLayout setFooterMaxDragRate(float rate)
Set the ratio of the maximum height to drag footer.
setFooterTranslationViewId
Link copied to clipboard
public RefreshLayout setFooterTranslationViewId(int id)
设置在 Footer 上下滚动时，需要跟随滚动的视图Id，默认整个内容视图
setFooterTriggerRate
Link copied to clipboard
public RefreshLayout setFooterTriggerRate(float rate)
Set the ratio at which the load more is triggered.
setHeaderHeight
Link copied to clipboard
public RefreshLayout setHeaderHeight(float heightDp)
Set the Header's height.
setHeaderHeightPx
Link copied to clipboard
public RefreshLayout setHeaderHeightPx(int height)
设置 Header 高度
setHeaderInsetStart
Link copied to clipboard
public RefreshLayout setHeaderInsetStart(float insetDp)
Set the Header's start offset（see srlHeaderInsetStart in the RepastPracticeActivity XML in demo-app for the practical application）.
setHeaderInsetStartPx
Link copied to clipboard
public RefreshLayout setHeaderInsetStartPx(int insetPx)
Set the Header's start offset（see srlHeaderInsetStart in the RepastPracticeActivity XML in demo-app for the practical application）.
setHeaderMaxDragRate
Link copied to clipboard
public RefreshLayout setHeaderMaxDragRate(float rate)
Set the ratio of the maximum height to drag header.
setHeaderTranslationViewId
Link copied to clipboard
public RefreshLayout setHeaderTranslationViewId(int id)
设置在 Header 上下滚动时，需要跟随滚动的视图Id，默认整个内容视图
setHeaderTriggerRate
Link copied to clipboard
public RefreshLayout setHeaderTriggerRate(float rate)
Set the ratio at which the refresh is triggered.
setNestedScrollingEnabled
Link copied to clipboard
public void setNestedScrollingEnabled(boolean enabled)
setNoMoreData
Link copied to clipboard
public RefreshLayout setNoMoreData(boolean noMoreData)
Restore the original state after finishLoadMoreWithNoMoreData.
setOnLoadMoreListener
Link copied to clipboard
public RefreshLayout setOnLoadMoreListener(OnLoadMoreListener listener)
Set load more listener separately.
setOnMultiListener
Link copied to clipboard
public RefreshLayout setOnMultiListener(OnMultiListener listener)
Set up a multi-function listener.
setOnRefreshListener
Link copied to clipboard
public RefreshLayout setOnRefreshListener(OnRefreshListener listener)
Set refresh listener separately.
setOnRefreshLoadMoreListener
Link copied to clipboard
public RefreshLayout setOnRefreshLoadMoreListener(OnRefreshLoadMoreListener listener)
Set refresh and load listeners at the same time.
setPrimaryColors
Link copied to clipboard
public RefreshLayout setPrimaryColors(Array<int> primaryColors)
Set theme color int (primaryColor and accentColor).
setPrimaryColorsId
Link copied to clipboard
public RefreshLayout setPrimaryColorsId(Array<int> primaryColorId)
Set theme color id (primaryColor and accentColor).
setReboundDuration
Link copied to clipboard
public RefreshLayout setReboundDuration(int duration)
Set the duration of the rebound animation.
setReboundInterpolator
Link copied to clipboard
public RefreshLayout setReboundInterpolator(Interpolator interpolator)
Set the rebound interpolator.
setRefreshContent
Link copied to clipboard
public RefreshLayout setRefreshContent(View content)
Set the content of RefreshLayout（Suitable for non-XML pages, not suitable for replacing empty layouts）。 设置指定的 Content（适用于非XML页面，不适合用替换空布局）
public RefreshLayout setRefreshContent(View content, int width, int height)
Set the content of RefreshLayout（Suitable for non-XML pages, not suitable for replacing empty layouts）.
setRefreshFooter
Link copied to clipboard
public RefreshLayout setRefreshFooter(RefreshFooter footer)
public RefreshLayout setRefreshFooter(RefreshFooter footer, int width, int height)
Set the footer of RefreshLayout.
setRefreshHeader
Link copied to clipboard
public RefreshLayout setRefreshHeader(RefreshHeader header)
public RefreshLayout setRefreshHeader(RefreshHeader header, int width, int height)
Set the header of RefreshLayout.
setScrollBoundaryDecider
Link copied to clipboard
public RefreshLayout setScrollBoundaryDecider(ScrollBoundaryDecider boundary)
Set the scroll boundary Decider, Can customize when you can refresh.