Android development order process View example details

Android development order process View example details

Let's take a look at the final rendering:

How about it? The effect is still very good, isn't it? Some people in the group say that there are four pictures, recycleview and all kinds of, but the simplest is to implement it through custom view. Next, let's implement this (order process view).

First, we define our custom attributes:

attrs.xml

Then there is our old routine. Create a class called processview to inherit the view, and then define the properties we need:

Then we will rewrite our onmeasure method. We will not consider the height of the control as wrap_ Content this is the case, so we only need to measure the height:

Then comes our core method ondraw(). The code is very simple and has comments. I won't explain them one by one:

OK ~ ~ then we expose a method to the outside and modify the progress:

Finally, we can run:

activity_ main.xml

arrays.xml:

Then our test activity:

Finally, attach all the codes of processview:

Thank you for reading, hope to help you, thank you for your support to this site!

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