Euphor08 Euphor08 - 7 months ago 18
Java Question

Design a circle of items Android

I had to do something like this,but I have no idea where or how to start.
what's the name of this design ? I mean a circle with elements ?
and how to put a texteview with an angle of rotation ?

the goal is when I click in the circle the categories appears like the picture, so how I can do this animation ?
enter image description here

Answer

You'll need some assets to create those ragged lines.

You can rotate TextViews with setRotation(), calculating the rotation when inflating your view. To do so, you'll first have to determine the positions you want to put the text at and then calculate the angle by looking at the difference in x and y position from the center of the circle.

Edit: After OP specified the requirements in comments on this questions:

Inflate the view with all text elements 'hidden' (android:visibility="gone" in your xml file) and calculate the final rotations and positions for everything outside of the circle that you need to animate. Set a listener on the initial circle, which starts animations on all elements to change:

  • their visibility to View.VISIBLE
  • their position to what you've calculated
  • their rotation to what you've calculated

For this, you'll likely want to use an AnimationSet, look at this SO question for inspiration.