YourMJK
YourMJK

Reputation: 1629

Time Circle Animation for Android App

How can I implement an animation in Android Studio where a circle "closes" in a specific interval (30 seconds) like that and repeat itself?

Animation screenshot 1

Animation screenshot 2

Upvotes: 0

Views: 1503

Answers (1)

Graeme
Graeme

Reputation: 25864

If you want to do it yourself (It's quite fun) then here's what you need:

Create a custom view, in the onDraw(Canva canvas) method, you need to:

  • draw a grey circle, centered in your view.
  • draw a blue arc, it's angle being a percentage of 360 describing the percentage of time which has happened (this should be backed by a timing mechanism)
  • draw a light blue circle (same colour as the parent) with the same center as both above.
  • Either draw text (or, can be slightly easier, create a child TextView and layer it ontop).

The code for all of those things is pretty easy to find on SO.

Good luck!

Upvotes: 2

Related Questions