Implementation of horizontal movement of Android viewpager album
When we download QQ for the first time and open it, there will be a novice guide. The guide is a few pictures, plus some text descriptions. Slide to the right until the end. I got up early this morning and studied the viewpager control for the implementation of this effect.
The following example will use viewpager to move photo albums horizontally. Viewpager has a corresponding pageradapter for binding data; We need to inherit this class and implement our own functions.
1. First, define the data object imageitem that a display item needs to use
2. Each side of the viewpager is an item, so define an item of each page of the viewpager in the layout directory, named pageritem.xml
3. Create a new Java file corresponding to each item of viewpager
4. Create a new data filler pageriteminadapter, which inherits from pagertadapter
5. Add a viewpager control to the main.xml file
6. Modify mainactivity as follows: