Android realizes the effect of automatic rotation and infinite loop with indicator points

To achieve infinite rotation, slide all the way to the left. When you reach the last view, you will slide to the first, infinite

You can write your own viewpager and then add a handler to realize automatic scrolling. Of course, here I directly use trinea's Android auto scroll view pager library for the progress of the project. Website: Click to enter GitHub reference library compile ('cn. Trinea. Android. View. Autoscrollviewpager: Android auto scroll view pager: 1.1.2 ') {exclude module:' support-v4 '

1. The layout is

2. Build pageradapter and inherit from recycling pageradapter (the source code will be posted later)

3 viewpager can be set in activity or fragment

Defined member variables:

Then you dislike that the official picture changing interval is too short, which can be set by reflection

4. Then our little dot has not been used yet. Here I write the method:

Don't forget to rewrite

All right, infinite loop automatic rotation, finished

5 point layout:

6 point background dot_ normal.xml

dot_ selected.xml

The source code of recyclingpageradapter depends on the recyclebin class and is posted together

RecyclingPagerAdapter

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>