同步操作将从 树朾/SmartRefreshLayout 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
SmartRefreshLayout's goal is to build a strong, stable and mature pull-down refresh layout framework, and to integrate all kinds of cool, diverse, practical and beautiful Headers and Footers.
FeedList | |
---|---|
Repast | Profile |
---|---|
Style | Delivery | DropBox |
---|---|---|
Demo | ||
Design | Refresh-your-delivery | DropBox-Refresh |
The two above headers are implemented by myself, The following headers are collected and optimized from excellent Headers on github
Style | BezierRadar | BezierCircle |
---|---|---|
Demo | ||
From | TwinklingRefreshLayout | Pull Down To Refresh |
Style | FlyRefresh | Classics |
---|---|---|
Demo | ||
From | FlyRefresh | ClassicsHeader |
Style | Phoenix | Taurus |
---|---|---|
Demo | ||
From | Yalantis/Phoenix | Yalantis/Taurus |
Style | BattleCity | HitBlock |
---|---|---|
Demo | ||
From | FunGame/BattleCity | FunGame/HitBlock |
Style | WaveSwipe | Material |
---|---|---|
Demo | ||
From | WaveSwipeRefreshLayout | MaterialHeader |
Style | StoreHouse | WaterDrop |
---|---|---|
Demo | ||
From | Ultra-Pull-To-Refresh | WaterDrop |
See so many cool headers, is not it feel great? At this point you may be worried that so many headers together, but usually only use one, is not to introduce a lot of useless code and resources?
Please rest assured that I have divided it into eight packages, when used to reference their own it!
V 2.x changed the package name relative to 1.x, such as com.scwang.smartrefresh
to com.scwang.smart.refresh
.
It is suggested that in the new project, if the old project is upgraded,
the package name should be replaced, which is more troublesome.
But the main change is to subcontract SmartRefreshLayout to reduce unnecessary dependencies and avoid code redundancy.
However, there is no subcontracting to SmartRefreshHeader.
There are more than ten headers in it.
It is recommended that you copy the source code into the project whenever you need to use it.
// Note: There will be no default Header and Footer after subcontracting. It needs to be added manually!
implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' //core
implementation 'com.scwang.smart:refresh-header-classics:2.0.1' //ClassicsHeader
implementation 'com.scwang.smart:refresh-header-radar:2.0.1' //BezierRadarHeader
implementation 'com.scwang.smart:refresh-header-falsify:2.0.1' //FalsifyHeader
implementation 'com.scwang.smart:refresh-header-material:2.0.1' //MaterialHeader
implementation 'com.scwang.smart:refresh-header-two-level:2.0.1' //TwoLevelHeader
implementation 'com.scwang.smart:refresh-footer-ball:2.0.1' //BallPulseFooter
implementation 'com.scwang.smart:refresh-footer-classics:2.0.1' //ClassicsFooter
If you use AndroidX, add it to gradle.properties
android.useAndroidX=true
android.enableJetifier=true
<?xml version="1.0" encoding="utf-8"?>
<com.scwang.smart.refresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:background="#fff" />
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
RefreshLayout refreshLayout = (RefreshLayout)findViewById(R.id.refreshLayout);
refreshLayout.setRefreshHeader(new ClassicsHeader(this));
refreshLayout.setRefreshFooter(new ClassicsFooter(this));
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
refreshlayout.finishRefresh(2000/*,false*/);//传入false表示刷新失败
}
});
refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(RefreshLayout refreshlayout) {
refreshlayout.finishLoadMore(2000/*,false*/);//传入false表示加载失败
}
});
public class App extends Application {
public void onCreate() {
super.onCreate();
SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
@Override
public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
return new ClassicsHeader(context).setSpinnerStyle(SpinnerStyle.Translate);
}
});
SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
@Override
public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
return new ClassicsFooter(context).setSpinnerStyle(SpinnerStyle.Translate);
}
});
}
}
Note: this method is the lowest priority.
<com.scwang.smart.refresh.layout.SmartRefreshLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#444444"
app:srlPrimaryColor="#444444"
app:srlAccentColor="@android:color/white"
app:srlEnablePreviewInEditMode="true">
<!--srlAccentColor and srlPrimaryColor, Will change the Header and Footer theme colors-->
<!--srlEnablePreviewInEditMode, Can open and close the preview function-->
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/dimenPaddingCommon"
android:background="@android:color/white"
android:text="@string/description_define_in_xml"/>
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
Note: this method of priority is medium。When using this method, the Android Studio will have preview effect, the following figure:
But don't worry, just a preview effect, run only the drop-down will appear.
final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
refreshLayout.setRefreshHeader(new MaterialHeader(this).setShowBezierWave(true));
refreshLayout.setRefreshFooter(new BallPulseFooter(this).setSpinnerStyle(SpinnerStyle.Scale));
This library does't use serialization and deserialization, JNI, reflection, so there is no need to add confusing filtering code, and it has been confusing tests pass, if you after the confusion in the use of the project appear problem, please inform me.
If you like this library's design, feel it help to you, you can point the upper right corner "Star" support Thank you! ^ _ ^ You can also click the PayPal below to ask the author to drink a cup of coffee.
If in the donation message note name, it will be record to the list
Donation list
github/Loror
github/faith-hb/WidgetCase
github/Bamboy120315/Freedom
github/TommyLemon/APIJSON
github/dengyuhan
github/zrp2017
github/fly803/BaseProject
github/razerdp
github/SuperChenC/s-mvp
github/KingJA/LoadSir
github/jianshijiuyou
github/zxy198717
github/addappcn
github/RainliFu
github/sugarya
github/stormzhang
Contact me: scwang90@hotmail.com
SwipeRefreshLayout
Ultra-Pull-To-Refresh
TwinklingRefreshLayout
BeautifulRefreshLayout
MultiWaveHeader
SmartRefreshHorizontal
Copyright 2017 scwang90
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。