当一个民族破灭,心理上退化时,便会衍生恶德德奢侈。——尼采
是这个组件:
https://github.com/scwang90/SmartRefreshLayout/
这里我用到了自定义 RefreshHeader
1 2 3 4 5
| ClassicsHeader classicsHeader = new ClassicsHeader(context); classicsHeader.setEnableLastTime(false); classicsHeader.setArrowResource(R.mipmap.foo); classicsHeader.setProgressResource(R.mipmap.bar); binding.smartRefreshLayout.setRefreshHeader(classicsHeader);
|
然后xml
1 2 3 4 5 6 7 8 9 10
| <com.scwang.smartrefresh.layout.SmartRefreshLayout android:id="@+id/smartRefreshLayout" android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/mainLl" app:srlEnableOverScrollBounce="true" app:srlEnableOverScrollDrag="true"> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
代码示例
SmartRefreshLayout
java代码设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| public class RefreshActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { RefreshLayout refreshLayout = (RefreshLayout)findViewById(R.id.refreshLayout); refreshLayout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white); refreshLayout.setDragRate(0.5f); refreshLayout.setReboundDuration(300);
refreshLayout.setHeaderHeight(100); refreshLayout.setHeaderHeightPx(100); refreshLayout.setFooterHeight(100); refreshLayout.setFooterHeightPx(100);
refreshLayout.setFooterHeaderInsetStart(0); refreshLayout.setFooterHeaderInsetStartPx(0); refreshLayout.setFooterFooterInsetStart(0); refreshLayout.setFooterFooterInsetStartPx(0);
refreshLayout.setHeaderMaxDragRate(2); refreshLayout.setFooterMaxDragRate(2); refreshLayout.setHeaderTriggerRate(1); refreshLayout.setFooterTriggerRate(1);
refreshLayout.setEnableRefresh(true); refreshLayout.setEnableLoadMore(false); refreshLayout.setEnableAutoLoadMore(true); refreshLayout.setEnablePureScrollMode(false); refreshLayout.setEnableNestedScroll(false); refreshLayout.setEnableOverScrollBounce(true); refreshLayout.setEnableScrollContentWhenLoaded(true); refreshLayout.setEnableHeaderTranslationContent(true); refreshLayout.setEnableFooterTranslationContent(true); refreshLayout.setEnableLoadMoreWhenContentNotFull(true); refreshLayout.setEnableFooterFollowWhenLoadFinished(false); refreshLayout.setEnableOverScrollDrag(false);
refreshLayout.setEnableScrollContentWhenRefreshed(true); refreshLayout.srlEnableClipHeaderWhenFixedBehind(true); refreshLayout.srlEnableClipFooterWhenFixedBehind(true);
refreshLayout.setDisableContentWhenRefresh(false); refreshLayout.setDisableContentWhenLoading(false);
refreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener()); refreshLayout.setScrollBoundaryDecider(new ScrollBoundaryDecider()); refreshLayout.setScrollBoundaryDecider(new ScrollBoundaryDeciderAdapter());
refreshLayout.setRefreshHeader(new ClassicsHeader(context)); refreshLayout.setRefreshFooter(new ClassicsFooter(context)); refreshLayout.setRefreshContent(new View(context));
refreshLayout.autoRefresh(); refreshLayout.autoLoadMore(); refreshLayout.autoRefreshAnimationOnly(); refreshLayout.autoLoadMoreAnimationOnly(); refreshLayout.autoRefresh(400); refreshLayout.autoLoadMore(400); refreshLayout.finishRefresh(); refreshLayout.finishLoadMore(); refreshLayout.finishRefresh(3000); refreshLayout.finishLoadMore(3000); refreshLayout.finishRefresh(false); refreshLayout.finishLoadMore(false); refreshLayout.finishLoadMoreWithNoMoreData(); refreshLayout.closeHeaderOrFooter(); refreshLayout.resetNoMoreData(); refreshLayout.setNoMoreData(false);
} }
public class App extends Application { static {
SmartRefreshLayout.setDefaultRefreshInitializer(new DefaultRefreshInitializer() { @Override public void initialize(@NonNull Context context, @NonNull RefreshLayout layout) { layout.setReboundDuration(1000); layout.setReboundInterpolator(new DropBounceInterpolator()); layout.setFooterHeight(100); layout.setDisableContentWhenLoading(false); layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white); } });
SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { @Override public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) { layout.setEnableHeaderTranslationContent(false); return new MaterialHeader(context).setColorSchemeResources(R.color.colorRed,R.color.colorGreen,R.color.colorBlue); } }); } }
|
xml代码设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| <com.scwang.smart.refresh.layout.SmartRefreshLayout android:id="@+id/refreshLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:srlAccentColor="@android:color/white" app:srlPrimaryColor="@color/colorPrimary" app:srlReboundDuration="300" app:srlDragRate="0.5"
app:srlHeaderMaxDragRate="2" app:srlFooterMaxDragRate="2" app:srlHeaderTriggerRate="1" app:srlFooterTriggerRate="1"
app:srlHeaderHeight="100dp" app:srlFooterHeight="100dp" app:srlHeaderInsetStart="0dp" app:srlFooterInsetStart="0dp"
app:srlEnableRefresh="true" app:srlEnableLoadMore="true" app:srlEnableAutoLoadMore="true" app:srlEnablePureScrollMode="false" app:srlEnableNestedScrolling="false" app:srlEnableOverScrollDrag="true" app:srlEnableOverScrollBounce="true" app:srlEnablePreviewInEditMode="true" app:srlEnableScrollContentWhenLoaded="true" app:srlEnableScrollContentWhenRefreshed="true" app:srlEnableHeaderTranslationContent="true" app:srlEnableFooterTranslationContent="true" app:srlEnableLoadMoreWhenContentNotFull="false" app:srlEnableFooterFollowWhenLoadFinished="false"
app:srlEnableClipHeaderWhenFixedBehind="true" app:srlEnableClipFooterWhenFixedBehind="true"
app:srlDisableContentWhenRefresh="false" app:srlDisableContentWhenLoading="false"
app:srlFixedFooterViewId="@+id/header_fixed" app:srlFixedHeaderViewId="@+id/footer_fixed" app:srlHeaderTranslationViewId="@+id/header_translation" app:srlFooterTranslationViewId="@+id/footer_translation" />
|
java代码设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| public class RefreshActivity extends Activity { static { ClassicsHeader.REFRESH_HEADER_PULLDOWN = "下拉可以刷新"; ClassicsHeader.REFRESH_HEADER_REFRESHING = "正在刷新..."; ClassicsHeader.REFRESH_HEADER_LOADING = "正在加载..."; ClassicsHeader.REFRESH_HEADER_RELEASE = "释放立即刷新"; ClassicsHeader.REFRESH_HEADER_FINISH = "刷新完成"; ClassicsHeader.REFRESH_HEADER_FAILED = "刷新失败"; ClassicsHeader.REFRESH_HEADER_SECONDARY = "释放进入二楼"; ClassicsHeader.REFRESH_HEADER_LASTTIME = "上次更新 M-d HH:mm"; ClassicsHeader.REFRESH_HEADER_LASTTIME = "'Last update' M-d HH:mm"; } @Override protected void onCreate(Bundle savedInstanceState) { ClassicsHeader.REFRESH_HEADER_PULLDOWN = getString(R.string.header_pulldown); ClassicsHeader.REFRESH_HEADER_REFRESHING = getString(R.string.header_refreshing); ClassicsHeader.REFRESH_HEADER_LOADING = getString(R.string.header_loading); ClassicsHeader.REFRESH_HEADER_RELEASE = getString(R.string.header_release); ClassicsHeader.REFRESH_HEADER_FINISH = getString(R.string.header_finish); ClassicsHeader.REFRESH_HEADER_FAILED = getString(R.string.header_failed); ClassicsHeader.REFRESH_HEADER_SECONDARY = getString(R.string.header_secondary); ClassicsHeader.REFRESH_HEADER_LASTTIME = getString(R.string.header_lasttime); ClassicsHeader.REFRESH_HEADER_LASTTIME = getString(R.string.header_lasttime); ClassicsHeader header = (ClassicsHeader)findViewById(R.id.header); header.setAccentColor(android.R.color.white); header.setPrimaryColor(R.color.colorPrimary); header.setTextSizeTitle(16); header.setTextSizeTitle(16, TypedValue.COMPLEX_UNIT_SP); header.setTextSizeTime(10); header.setTextSizeTime(10, TypedValue.COMPLEX_UNIT_SP); header.setTextTimeMarginTop(10); header.setTextTimeMarginTopPx(10); header.setEnableLastTime(true); header.setFinishDuration(500); header.setDrawableSize(20); header.setDrawableArrowSize(20); header.setDrawableProgressSize(20); header.setDrawableMarginRight(20); header.setDrawableSizePx(20); header.setDrawableArrowSizePx(20); header.setDrawableProgressSizePx(20); header.setDrawableMarginRightPx(20); header.setArrowBitmap(bitmap); header.setArrowDrawable(drawable); header.setArrowResource(R.drawable.ic_arrow); header.setProgressBitmap(bitmap); header.setProgressDrawable(drawable); header.setProgressResource(R.drawable.ic_progress); header.setTimeFormat(new DynamicTimeFormat("上次更新 %s")); header.setLastUpdateText("上次更新 3秒前"); header.setSpinnerStyle(SpinnerStyle.Translate); } }
|
xml代码设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <com.scwang.smart.refresh.layout.SmartRefreshLayout> <com.scwang.smart.refresh.footer.ClassicsHeader android:layout_width="match_parent" android:layout_height="wrap_content" app:srlAccentColor="@android:color/white" app:srlPrimaryColor="@color/colorPrimary" app:srlTextSizeTitle="16sp" app:srlTextSizeTime="10dp" app:srlTextTimeMarginTop="2dp" app:srlEnableLastTime="true" app:srlFinishDuration="500" app:srlDrawableSize="20dp" app:srlDrawableArrowSize="20dp" app:srlDrawableProgressSize="20dp" app:srlDrawableMarginRight="20dp" app:srlDrawableArrow="@drawable/ic_arrow" app:srlDrawableProgress="@drawable/ic_progress" app:srlClassicsSpinnerStyle="Translate" app:srlTextPulling="@string/srl_header_pulling" app:srlTextLoading="@string/srl_header_loading" app:srlTextRelease="@string/srl_header_release" app:srlTextFinish="@string/srl_header_finish" app:srlTextFailed="@string/srl_header_failed" app:srlTextUpdate="@string/srl_header_update" app:srlTextSecondary="@string/srl_header_secondary" app:srlTextRefreshing="@string/srl_header_refreshing"/> </com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
java代码设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| public class RefreshActivity extends Activity { static { ClassicsFooter.REFRESH_FOOTER_PULLING = "上拉加载更多"; ClassicsFooter.REFRESH_FOOTER_RELEASE = "释放立即加载"; ClassicsFooter.REFRESH_FOOTER_REFRESHING = "正在刷新..."; ClassicsFooter.REFRESH_FOOTER_LOADING = "正在加载..."; ClassicsFooter.REFRESH_FOOTER_FINISH = "加载完成"; ClassicsFooter.REFRESH_FOOTER_FAILED = "加载失败"; ClassicsFooter.REFRESH_FOOTER_NOTHING = "没有更多数据了"; } @Override protected void onCreate(Bundle savedInstanceState) { ClassicsFooter.REFRESH_FOOTER_PULLING = getString(R.string.footer_pulling); ClassicsFooter.REFRESH_FOOTER_RELEASE = getString(R.string.footer_release); ClassicsFooter.REFRESH_FOOTER_REFRESHING = getString(R.string.footer_refreshing); ClassicsFooter.REFRESH_FOOTER_LOADING = getString(R.string.footer_loading); ClassicsFooter.REFRESH_FOOTER_FINISH = getString(R.string.footer_finish); ClassicsFooter.REFRESH_FOOTER_FAILED = getString(R.string.footer_failed); ClassicsFooter.REFRESH_FOOTER_NOTHING = getString(R.string.footer_nothing);
ClassicsFooter footer = (ClassicsFooter)findViewById(R.id.footer); footer.setAccentColor(android.R.color.white); footer.setPrimaryColor(R.color.colorPrimary); footer.setTextSizeTitle(16); footer.setTextSizeTitle(16, TypedValue.COMPLEX_UNIT_SP); footer.setFinishDuration(500); footer.setDrawableSize(20); footer.setDrawableArrowSize(20); footer.setDrawableProgressSize(20); footer.setDrawableMarginRight(20); footer.setDrawableSizePx(20); footer.setDrawableArrowSizePx(20); footer.setDrawableProgressSizePx(20); footer.setDrawableMarginRightPx(20); footer.setArrowBitmap(bitmap); footer.setArrowDrawable(drawable); footer.setArrowResource(R.drawable.ic_arrow); footer.setProgressBitmap(bitmap); footer.setProgressDrawable(drawable); footer.setProgressResource(R.drawable.ic_progress); footer.setSpinnerStyle(SpinnerStyle.Translate); } }
|
xml代码设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <com.scwang.smart.refresh.layout.SmartRefreshLayout> <com.scwang.smart.refresh.footer.ClassicsFooter android:layout_width="match_parent" android:layout_height="wrap_content" app:srlAccentColor="@android:color/white" app:srlPrimaryColor="@color/colorPrimary" app:srlTextSizeTitle="16sp" app:srlFinishDuration="500" app:srlDrawableSize="20dp" app:srlDrawableArrowSize="20dp" app:srlDrawableProgressSize="20dp" app:srlDrawableMarginRight="20dp" app:srlDrawableArrow="@drawable/ic_arrow" app:srlDrawableProgress="@drawable/ic_progress" app:srlClassicsSpinnerStyle="Translate" app:srlTextPulling="@string/srl_footer_pulling" app:srlTextRelease="@string/srl_footer_release" app:srlTextLoading="@string/srl_footer_loading" app:srlTextRefreshing="@string/srl_footer_refreshing" app:srlTextFinish="@string/srl_footer_finish" app:srlTextFailed="@string/srl_footer_failed" app:srlTextNothing="@string/srl_footer_nothing"/> </com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
属性表格
Attributes
name |
format |
description |
srlPrimaryColor |
color |
主题颜色 |
srlAccentColor |
color |
强调颜色 |
srlReboundDuration |
integer |
释放后回弹动画时长(默认250毫秒) |
srlHeaderHeight |
dimension |
Header的标准高度(dp) |
srlFooterHeight |
dimension |
Footer的标准高度(dp) |
srlHeaderInsetStart |
dimension |
Header的起始偏移量(dp)V1.0.5 |
srlFooterInsetStart |
dimension |
Footer的起始偏移量(dp)V1.0.5 |
srlDragRate |
float |
显示拖动高度/真实拖动高度(默认0.5,阻尼效果) |
srlHeaderMaxDragRate |
float |
Header最大拖动高度/Header标准高度(默认2,要求>=1) |
srlFooterMaxDragRate |
float |
Footer最大拖动高度/Footer标准高度(默认2,要求>=1) |
srlHeaderTriggerRate |
float |
Header触发刷新距离 与 HeaderHeight 的比率(默认1) |
srlFooterTriggerRate |
float |
Footer触发加载距离 与 FooterHeight 的比率(默认1) |
srlEnableRefresh |
boolean |
是否开启下拉刷新功能(默认true) |
srlEnableLoadMore |
boolean |
是否开启加上拉加载功能(默认false-智能开启) |
srlEnableAutoLoadMore |
boolean |
是否监听列表惯性滚动到底部时触发加载事件(默认true) |
srlEnableHeaderTranslationContent |
boolean |
拖动Header的时候是否同时拖动内容(默认true) |
srlEnableFooterTranslationContent |
boolean |
拖动Footer的时候是否同时拖动内容(默认true) |
srlEnablePreviewInEditMode |
boolean |
是否在编辑模式时显示预览效果(默认true) |
srlEnablePureScrollMode |
boolean |
是否开启纯滚动模式(默认false-开启时只支持一个子视图) |
srlEnableOverScrollDrag |
boolean |
是否启用越界拖动(仿苹果效果)V1.0.4 |
srlEnableOverScrollBounce |
boolean |
设置是否开启越界回弹功能(默认true) |
srlEnableNestedScrolling |
boolean |
是否开启嵌套滚动NestedScrolling(默认false-智能开启) |
srlEnableScrollContentWhenLoaded |
boolean |
是否在加载完成之后滚动内容显示新数据(默认-true) |
srlEnableScrollContentWhenRefreshed |
boolean |
是否在刷新成功之后滚动内容显示新数据(默认-true) |
srlEnableLoadMoreWhenContentNotFull |
boolean |
在内容不满一页的时候,是否可以上拉加载更多(默认-false) |
srlEnableFooterFollowWhenLoadFinished |
boolean |
是否在全部加载结束之后Footer跟随内容 |
srlEnableClipHeaderWhenFixedBehind |
boolean |
是否剪裁Header当时样式为FixedBehind时V1.0.5 |
srlEnableClipFooterWhenFixedBehind |
boolean |
是否剪裁Footer当时样式为FixedBehind时V1.0.5 |
srlDisableContentWhenRefresh |
boolean |
是否在刷新的时候禁止内容的一切手势操作(默认false) |
srlDisableContentWhenLoading |
boolean |
是否在加载的时候禁止内容的一切手势操作(默认false) |
srlFixedHeaderViewId |
id |
指定固定顶部的视图Id |
srlFixedFooterViewId |
id |
指定固定底部的视图Id |
srlHeaderTranslationViewId |
id |
指定下拉Header时偏移的视图Id |
srlFooterTranslationViewId |
id |
指定上拉Footer时偏移的视图Id |
Method
name |
format |
description |
setPrimaryColors |
colors |
主题\强调颜色 |
setPrimaryColorsId |
colors |
主题\强调颜色资源Id |
setReboundDuration |
integer |
释放后回弹动画时长(默认250毫秒) |
setHeaderHeight |
dimension |
Header的标准高度(px/dp 两个版本) |
setFooterHeight |
dimension |
Footer的标准高度(px/dp 两个版本) |
setHeaderInsetStart |
dimension |
Header起始位置偏移量(px/dp 两个版本)V1.0.5 |
setFooterInsetStart |
dimension |
Footer起始位置偏移量(px/dp 两个版本)V1.0.5 |
setDragRate |
float |
显示拖动高度/真实拖动高度(默认0.5,阻尼效果) |
setHeaderMaxDragRate |
float |
Header最大拖动高度/Header标准高度(默认2,要求>=1) |
setFooterMaxDragRate |
float |
Footer最大拖动高度/Footer标准高度(默认2,要求>=1) |
setHeaderTriggerRate |
float |
Header触发刷新距离 与 HeaderHeight 的比率(默认1) |
setFooterTriggerRate |
float |
Footer触发加载距离 与 FooterHeight 的比率(默认1) |
setEnableRefresh |
boolean |
是否开启下拉刷新功能(默认true) |
setEnableLoadMore |
boolean |
是否开启加上拉加载功能(默认false-智能开启) |
setEnableHeaderTranslationContent |
boolean |
拖动Header的时候是否同时拖动内容(默认true) |
setEnableFooterTranslationContent |
boolean |
拖动Footer的时候是否同时拖动内容(默认true) |
setEnableAutoLoadMore |
boolean |
是否监听列表惯性滚动到底部时触发加载事件(默认true) |
setEnablePureScrollMode |
boolean |
是否开启纯滚动模式(默认false-开启时只支持一个子视图) |
setEnableOverScrollDrag |
boolean |
是否启用越界拖动(仿苹果效果)V1.0.4 |
setEnableOverScrollBounce |
boolean |
设置是否开启越界回弹功能(默认true) |
setEnableNestedScrolling |
boolean |
是否开启嵌套滚动NestedScrolling(默认false-智能开启) |
setEnableScrollContentWhenLoaded |
boolean |
是否在加载完成之后滚动内容显示新数据(默认-true) |
setEnableScrollContentWhenRefreshed |
boolean |
是否在刷新成功之后滚动内容显示新数据(默认-true)V1.0.5 |
setEnableLoadMoreWhenContentNotFull |
boolean |
在内容不满一页的时候,是否可以上拉加载更多(默认-false) |
setEnableFooterFollowWhenLoadFinished |
boolean |
是否在全部加载结束之后Footer跟随内容 |
setEnableClipHeaderWhenFixedBehind |
boolean |
是否剪裁Header当时样式为FixedBehind时V1.0.5 |
setEnableClipFooterWhenFixedBehind |
boolean |
是否剪裁Footer当时样式为FixedBehind时V1.0.5 |
setDisableContentWhenRefresh |
boolean |
是否在刷新的时候禁止内容的一切手势操作(默认false) |
setDisableContentWhenLoading |
boolean |
是否在加载的时候禁止内容的一切手势操作(默认false) |
setReboundInterpolator |
Interpolator |
设置回弹动画的插值器(默认减速) |
setRefreshHeader |
RefreshHeader |
设置指定的Header(默认贝塞尔雷达) |
setRefreshFooter |
RefreshFooter |
设置指定的Footer(默认球脉冲) |
setRefreshContent |
View |
设置刷新Content(用于动态替换空布局) |
setOnRefreshListener |
OnRefreshListener |
设置刷新监听器(不设置,默认3秒后关刷新) |
setOnLoadMoreListener |
OnLoadMoreListener |
设置加载监听器(不设置,默认3秒后关加载) |
setOnRefreshLoadMoreListener |
OnRefreshLoadMoreListener |
同时设置上面两个监听器 |
setOnMultiPurposeListener |
OnMultiPurposeListener |
设置多功能监听器 |
setLoadMoreFinished |
boolean |
设置全部数据加载完成,之后不会触发加载事件 |
setScrollBoundaryDecider |
boundary |
设置滚动边界判断 |
finishRefresh |
(int delayed) |
完成刷新,结束刷新动画 |
finishLoadMore |
(int delayed) |
完成加载,结束加载动画 |
finishRefresh |
(boolean success) |
完成刷新,并设置是否成功 |
finishLoadMore |
(boolean success) |
完成加载,并设置是否成功 |
finishLoadMoreWithNoMoreData |
|
完成加载并标记没有更多数据(V1.0.4) |
closeHeaderOrFooter |
|
关闭 Header 或者 Footer(1.1.0) |
resetNoMoreData |
|
V1.0.4(V1.1.0删除,用 setNoMoreData(false) 代替) |
setNoMoreData |
boolean |
设置更多数据状态V1.0.5 |
getRefreshHeader |
RefreshHeader |
获取Header |
getRefreshFooter |
RefreshFooter |
获取Footer |
getState |
RefreshState |
获取当前状态 |
isRefreshing |
boolean |
(V1.1.0删除,版本用 getState==Refreshing 代替) |
isLoading |
boolean |
(V1.1.0删除,版本用 getState==Loading 代替) |
autoRefresh |
(int delayed) |
触发自动刷新 |
autoLoadMore |
(int delayed) |
触发自动加载 |
autoRefreshAnimationOnly |
|
触发自动刷新,只显示动画不执行刷新 |
autoLoadMoreAnimationOnly |
|
触发自动加载,只显示动画不执行加载 |
name |
format |
description |
srlPrimaryColor |
color |
主题颜色 |
srlAccentColor |
color |
强调颜色 |
srlDrawableArrow |
drawable |
箭头图片 |
srlDrawableProgress |
drawable |
转动图片 |
srlClassicsSpinnerStyle |
enum |
变换样式:Translate(平行移动)、Scale(拉伸形变)、FixedBehind(固定在背后) |
srlSpinnerStyle |
enum |
变换样式:srlClassicsSpinnerStyle的全部、FixedFront(固定在前面或全屏) |
srlFinishDuration |
int |
动画结束时,显示完成状态停留的时间(毫秒) |
srlEnableLastTime |
boolean |
是否显示上次更新时间(默认true) |
srlDrawableMarginRight |
dimension |
图片相对右边文字的距离(默认20dp) |
srlTextTimeMarginTop |
dimension |
更新时间相对上面标题的距离(默认2dp) |
srlTextSizeTitle |
dimension |
标题文字大小(默认16sp) |
srlTextSizeTime |
dimension |
时间文字大小(默认12sp) |
name |
format |
description |
setPrimaryColor |
color |
主题颜色 |
setAccentColor |
color |
强调颜色 |
setArrowDrawable |
drawable |
设置箭头图片 |
setProgressDrawable |
drawable |
设置转动图片 |
setArrowBitmap |
bitmap |
设置箭头图片(V1.1.0版本删除) |
setProgressBitmap |
bitmap |
设置转动图片(V1.1.0版本删除) |
setArrowResource |
int |
设置箭头图片 |
setProgressResource |
int |
设置转动图片 |
setSpinnerStyle |
enum |
变换样式:参考属性srlSpinnerStyle |
setClassicsSpinnerStyle |
enum |
变换样式:参考属性srlClassicsSpinnerStyle |
setFinishDuration |
int |
设置动画结束时,显示完成状态停留的时间(毫秒) |
setEnableLastTime |
boolean |
是否显示上次更新时间(默认true) |
setTextSizeTitle |
dimension |
标题文字大小(默认16sp) |
setTextSizeTime |
dimension |
时间文字大小(默认12sp) |
setLastUpdateText |
string |
手动设置更新时间,将不会自动更新时间 |