A few days ago to see a number of applications including know-how have used a small circle to scrub the effect of the refresh, carefully checked, the original Android V7 package inside the latest refresh effect. It is also very simple to use.
First, create an activity, which is written in the layout file:
1 <Android.support.v4.widget.SwipeRefreshLayout2 Android:id= "@+id/sr"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Wrap_content">5 <ListView6 Android:id= "@+id/li_main"7 Android:layout_width= "Match_parent"8 Android:layout_height= "Wrap_content">9 </ListView>Ten</Android.support.v4.widget.SwipeRefreshLayout>
It is equivalent to placing the content to be refreshed in the Swiperefreshlayout control. Then you can set the color and Refresh listener events in the activity:
1 @Override2 protected voidonCreate (Bundle savedinstancestate) {3 Super. OnCreate (savedinstancestate);4 Setcontentview (r.layout.activity_main);5 init ();6List_main =(ListView) Findviewbyid (r.id.li_main);7SR =(swiperefreshlayout) Findviewbyid (R.ID.SR);8 Sr.setcolorschemeresources (Android. R.color.holo_blue_bright,9 Android. R.color.holo_green_light,Ten Android. R.color.holo_orange_light, One Android. R.color.holo_red_light); ASr.setonrefreshlistener (NewSwiperefreshlayout.onrefreshlistener () { - @Override - Public voidOnrefresh () { the Reflesh (); -Sr.setrefreshing (false); - } - }); + -}
1 Private void init () {2 New Arraylist<>(); 3 string[] args = {"000000000000", "111111111", "222222222222", "3333333333333", "444444444444444444", " 555555555555555555 "," 6666666666666666 "," 77777777777777777 "}; 4 for (String A:args) {5 List.add (a); 6 }7 }
Here is the rough effect:
Here is the demo address: Http://files.cnblogs.com/files/lout/zhihufresh.zip
Android knows small circle refresh effect