Method for put arrow in specific degree in Android studio ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Method for put arrow in specific degree in Android studio ?

I need method to put arrow of compass in specific degree like 102° how i Can Do it

3rd Dec 2022, 5:21 PM
Izmiir
Izmiir - avatar
1 Answer
+ 2
Use svg or have a look about canvas to draw do something like that for (float angle = 0; angle < 361; angle = angle + pointAngle) { //move round the circle to each point float displacedAngle = angle - 90; float x = cx + ((float)Math.Cos(radians(displacedAngle)) * radius); //convert angle to radians for x and y coordinates float y = cy + ((float)Math.Sin(radians(displacedAngle)) * radius); canvas.DrawLine(cx, cy, x, y, paint); //draw a line from center point back to the point }
3rd Dec 2022, 7:14 PM
A S Raghuvanshi
A S Raghuvanshi - avatar