Android knows small circle refresh effect

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.