SmartRefreshLayout


Source link: https://github.com/scwang90/SmartRefreshLayout

Android????????-SmartRefreshLayout

English | ??

???????SmartRefreshLayout???“??”??“??”????????????“??”??????????View??????????????????ViewGroup ???FrameLayout?LinearLayout??????? ?????????????????????????? SwipeRefreshLayout??????? Ultra-Pull-To-Refresh? TwinklingRefreshLayout ?????????? Header ? Footer?
SmartRefreshLayout??????????????????????????????????????????Header?Footer?

????:

  • ??????
  • ???????????
  • ????? View?AbsListView?RecyclerView?WebView....View?
  • ????????????????? Header ? Footer.
  • ???ListView??????? ? CoordinatorLayout ????? .
  • ????????????????????????????????????.
  • ?????????????????????????.
  • ??????????????App??????????????.
  • ????????????????????????????
  • ??????????????

???

Demo

?? APK-Demo

????

???? ????
???? ????

???? Style

Delivery Dropbox
Refresh-your-delivery Dropbox-Refresh

???????????????????github??????Header?????????????

BezierRadar BezierCircle
Pull To Refresh Pull Down To Refresh
FlyRefresh Classics
FlyRefresh ClassicsHeader
Phoenix Taurus
Yalantis/Phoenix Yalantis/Taurus
BattleCity HitBlock
FunGame/BattleCity FunGame/HitBlock
WaveSwipe Material
WaveSwipeRefreshLayout MaterialHeader
StoreHouse WaterDrop
Ultra-Pull-To-Refresh WaterDrop

????????Header?????????????????????Header??????????????????????????????????
?????????????????????????????????

  • SmartRefreshLayout ???????????ClassicsHeader?????BezierRadarHeader????????? Header.
  • SmartRefreshHeader ??Header??????Layout???Header?????????.
  • SmartRefreshFooter ??Footer??????Layout???Footer?????????.

????

1.? buld.gradle ?????

//??????-??bug????????? 1.0.3 ?? compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.4-alpha-12' compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.4-alpha-12'//??????Header???????  compile 'com.android.support:appcompat-v7:25.3.1'//???????? compile 'com.android.support:design:25.3.1'//??????????????????????  //??? compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3' compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.3'//??????Header???????  

2.?XML??????? SmartRefreshLayout

<?xml version="1.0" encoding="utf-8"?> <com.scwang.smartrefresh.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">
  <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.smartrefresh.layout.SmartRefreshLayout>

3.? Activity ?? Fragment ?????

RefreshLayout refreshLayout = (RefreshLayout)findViewById(R.id.refreshLayout);
 refreshLayout.setOnRefreshListener(new OnRefreshListener() {

  @Override
  public void onRefresh(RefreshLayout refreshlayout) {

refreshlayout.finishRefresh(2000);

  
}
 
}
);
 refreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {

  @Override
  public void onLoadmore(RefreshLayout refreshlayout) {

refreshlayout.finishLoadmore(2000);

  
}
 
}
);

????? Header ? Footer

1.??? ????

public class App extends Application {

  //static ???????????
  static {

//?????Header???

SmartRefreshLayout.setDefaultRefreshHeaderCreater(new DefaultRefreshHeaderCreater() {

  @Override

  public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {

layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white);
//????????

return new ClassicsHeader(context).setTimeFormat(new DynamicTimeFormat("??? %s"));
//?????Header???? ?????Header

  
}

 
}
);

//?????Footer???

SmartRefreshLayout.setDefaultRefreshFooterCreater(new DefaultRefreshFooterCreater() {

  @Override

  public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {

//?????Footer???? BallPulseFooter

return new ClassicsFooter(context).setDrawableSize(20);

  
}

 
}
);

  
}
 
}

?????? ???Header?Footer????????????????????????????????

2.??? XML??????

<com.scwang.smartrefresh.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 srlPrimaryColor ???? Header ? Footer ?????-->
  <!--srlEnablePreviewInEditMode ???????????-->
  <com.scwang.smartrefresh.layout.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/padding_common"

android:background="@android:color/white"

android:text="@string/description_define_in_xml"/>
  <com.scwang.smartrefresh.layout.footer.ClassicsFooter

android:layout_width="match_parent"

android:layout_height="wrap_content"/> </com.scwang.smartrefresh.layout.SmartRefreshLayout>

?????? XML???Header?Footer????????????????????????????Android Studio ???????????

???????????????????????????~

3.??? Java????

final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
 //?? Header ? Material?? refreshLayout.setRefreshHeader(new MaterialHeader(this).setShowBezierWave(true));
 //?? Footer ? ??? refreshLayout.setRefreshFooter(new BallPulseFooter(this).setSpinnerStyle(SpinnerStyle.Scale));

??

SmartRefreshLayout ???????????????JNI????????????????????????????????????????????????????????

??

????? SmartRefreshLayout ?????? SmartRefreshLayout ???????????? "Star" ???? ??? ^_^
?????????????~ ?????????

??????????????????????~ ?????github????????????github?????????????????????????????????
????

??

QQ??? - 602537182 ????

????

???????????????????????????????????????????Bug????????????? ?????????????????????????????????????bug??????????????????? ?????????????????????????????????????????????????????????? ??????????????????bug????????????????????bug?? ?????????????????????????????????????????????????????????? ???QQ????

QQ??? - 538979188 ??? 477963933 ???

????

?????????????????????????????????????????????????????????? ????????????????????????????Bug????????????????????????????? ????????????????????????????????????????????????????????

????

???????????????~

??

SwipeRefreshLayout
Ultra-Pull-To-Refresh
TwinklingRefreshLayout
BeautifulRefreshLayout

License

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. 

Resources

A set of custom views used to navigate between the pages (or indicate the current position) of a ViewPager from the Android Support Package.

This library allows you to embed a Barcode scanner as a Fragment.

Nammu is a simple library to speed up working with new Runtime Permissions introduced in Android M.

BottomSheet is an Android component which presents a dismissible view from the bottom of the screen. BottomSheet can be a useful replacement for dialogs and menus but can hold any view so the use cases are endless.

Vault is an Android library that simplifies persistence of data from Contentful via SQLite. It lets you define Java representations for your Contentful models.

Android Library to make a cool intro for your app.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes