The Android boot page is implemented using viewpager

When we install an app, we will basically have a guide page prompt. They can advertise or introduce the addition and use instructions of new functions. Sliding is generally supported, and there are several points below to display the total number of pages and the position of the current picture. It is relatively simple to implement on IOS, but how to implement it on Android. Today, let's learn to use the viewpager under the official V4 support package to achieve this effect.

Start with the above figure:

The following is my implementation, an XML layout, a guideactivity and a guidepageadapter. Start with XML

I'm preparing an adapter. There's nothing to say about it.

Finally, our activity

In general, the implementation process is relatively simple. 1) First load the viewpager, create a new ImageView and add it to the view collection, and then set the adapter and display it. 2) Then load the LinearLayout and place the origin image. Similarly, create a new ImageView and place it in the dot graph collection after setting the background. 3) Finally, set the sliding listening event of viewpager. In the sliding listening onpageselected method, set the corresponding dot as selected. If it is the last page, the button will be displayed.

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
分享
二维码
< <上一篇
下一篇>>