Android make similar payment circle and hook interface Progresswheel

Source: Internet
Author: User

The first thing to note is that the effect of making a circle rotation is not what the blogger does, it's referring to a code on GitHub, just adding a change to it, optimizing it, and adding a tick animation.

First look at the effect, 1+ 's phone to get root permissions is really difficult, unable to record screen, can only use this screenshot to generate Git stupid method, in fact, the operation is still very smooth.

This is the address of the code GitHub:

git clone https://github.com/lxxcaroline/progresswheelview.git

This is the GitHub address of the Circle rotation code:

git clone https://github.com/pnikosis/materialish-progress.git  

My amendment to the original author's code is

1. The original author calls invalidate directly in the OnDraw function, which causes the interface to refresh, especially when you open the settings in this developer option and then go back to the application's interface and find that he is frequently refreshed. The advice my boss gave me was to use Handler.sendmessagedelay (Message, Delaymills) to invoke the Invalidate method in the Handlemessage method of handler each time the delay was refreshed, In the OnDraw function to send a message to handler can, as long as the 16ms within the refresh frame does not lag is good.

2. The animation of the hook is my main modification, divided into two straight lines to draw. Here is my design, the middle of the small box side length is the code in the Ticksize, so each time the painting will go to the center of the circle, and then centered to draw a square, respectively draw a tick of two lines, draw short first, draw short and then began to draw long.

There are comments in the code, let's see for yourselves.

Android make similar payment circle and hook interface Progresswheel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.