Android custom controls create a gorgeous parallel space guide page

This example shares the specific code of Android custom control to create parallel space guide page for your reference. The specific contents are as follows

First, the figure above is too large to be transmitted. There are moving pictures in the project

Click to view the dynamic diagram

First, explain the main parts of the project.

First of all, Google's percentage layout has been partially modified, because the width and height I set are relative to the width of the screen, and Google's percentage layout can't be realized. It only needs to modify part of the code. Some modified codes are posted below

First of all, I modified the base class of width and height identification and added some identification fields. Of course, only adding these fields can not be realized. I also need to return the corresponding standards after the identification fields

These two pieces of code can help us to set the width and height relative to the width and height of the screen. The code is not too complex. The complete code of the project will be posted later. Transformpage (view, float position) is used in the project. First, I will introduce this function. This function will trigger this function when the layout slides. Position represents the distance from each view layout in each viewpager to the left of the screen. Setoffscreen pagelimit (int number) can set the viewpage buffer page. Several pages can be buffered on the left and right sides of the current page, For example, number = 2 means that there can be at most two buffers on the left and right sides of the current page. This number is related to the view in the transformpage.

First look at a picture

Every time you move the view, you will call the transform function. Id0, 1 and 2 represent three pages, and position represents the distance from the three pages to the left of the screen. Others use some attribute animation, and the gradient of background color uses interpolator. After reading the code, you will understand the project address. You can ask questions at any time if you don't understand it

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