Description:
The PullToRefreshView is based on the animation that was modified on SwipeRefreshLayout of the v4 library. SwipeRefreshLayout also has the PullToRefreshView method.Copy the code
1. Add to build.gradle of Properties
allprojects {
repositories {
......
maven { url "https://jitpack.io" }
}
}Copy the code
2. Add it to build.gradle of Module
The compile 'com. Making. Songixan: SmileRefresh: 1.1'Copy the code
Usage:
-
XML add
Copy the code
-
Java Settings
- Initialize the
mRefreshView = (PullToRefreshView) findViewById(R.id.refreshView); mRefreshView.setColorSchemeColors(Color.RED,Color.BLUE); / / color mRefreshView setSmileStrokeWidth (8); / / set to draw the width of the smiling face of mRefreshView. SetSmileInterpolator (new LinearInterpolator ()); . / / smiling face animation rotation interpolator mRefreshView setSmileAnimationDuration (2000); / / set the smiling face of rotating animation time. / / set the drop-down refresh to monitor mRefreshView setOnRefreshListener (new PullToRefreshView. OnRefreshListener () {@ Override public void onRefresh() { requestData(); // request data}});Copy the code
- Refresh to complete
/ / request data complete mRefreshView setRefreshing (false);Copy the code
Blog: blog.csdn.net/qq_32464809…