Android imitation millet clock effect
I saw the implementation of Xiaomi clock on a [blog] Android high imitation Xiaomi clock (using camera and matrix to achieve 3D effect). I was particularly interested. I looked at it carefully and knocked it myself. Here are my own understanding and some improvements. The effect is really great, so I released my own clock application.
Let's start with the above figure (the computer doesn't have GIF screenshot software. Let's make do. Which software is good can also be recommended to me)
Not much to say. First of all, the custom control ximiclockview inherits the view and does some initialization operations. The beautiful clock picture I see is my own rendering (mom won't have to worry about me being late in the future)
Then we call in the onSizeChange method to get the clock radius and some other calculations.
Draw text
When I finished writing the crash, I prompted that I didn't log in when I published it, and then published an exception. Then I refreshed it and wrote it again,
Next, draw an arc
Draw scale
Draw the second hand
Draw the hour hand
Draw minute hand
On my measure method
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.