Android uses recyclerview to realize the effect of horizontal automatic circular scrolling of pictures
Introduction:
This blog mainly introduces how to use recyclerview to realize the automatic circulation of pictures in the horizontal direction (marquee effect)
Renderings:
Idea:
1. Prepare m pictures
1. Use the recyclerview implementation to return countless (actual interge. Maxvalue) items, and the nth item displays the nth% m picture
3. Use recyclerview.scrollby to scroll horizontally for a distance at a time
4. Through layoutmanager. Findfirstvisibleitemposition(), get the number of items in the first view currently displayed, and the ImageView above displays the corresponding de picture
Implementation code:
XML file
1. Activity layout file_ recy.xml
2. Adapter layout item_ horizon.xml
Activity
Adapter recyadapter
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.