0

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

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
YourMJK
  • 1,429
  • 1
  • 11
  • 22

1 Answers1

2

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!

Graeme
  • 25,714
  • 24
  • 124
  • 186