An example of Android viewpager implementing infinite loop
An example of Android viewpager implementing infinite loop
Viewpager itself does not support the function of left-right infinite loop. Here is a scheme to enable Android viewpager to realize the function of left-right infinite loop. Here is a record:
The mviews used for display has two more node elements than the data source MLIST (head node 0: B and tail node 5: e are used for jump)
The red line without arrow in the following figure is the initialization of mviews according to MLIST; The red line with arrow is the case of jump.
First, the layout file:
Next comes mainactivity:
The above code is just a simple demo. If the jump animation is not removed, the transition effect will be very unnatural when jumping from the first and last pages.
Thank you for reading, hope to help you, thank you for your support to this site!