Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing imageviews in a circular manner by placing a center in android

I want to implement drag and drop in android 4.1, for that i want to place my icons image views in circular manner around a center point. (with image view i can implement drag and drop perfectly, with bitmap its somewhat complex)

I tried with bitmaps and paint but it is not as smooth, as we can get in android 4.1.

Is there any method or way in android 4.1 by which i can place the imageviews in circular manner by giving the radius of the circle and number of sections it will get divide, its like a math question ?

Take a look at this link for drag and drop.

Thanks in advance for help.

like image 966
akashPatra Avatar asked Dec 31 '25 20:12

akashPatra


1 Answers

I have implemented by using Math in android.

I am sharing a part of my code:

double xOffset = currentRadius * Math.cos(Math.toRadians(d));
double yOffset = currentRadius * Math.sin(Math.toRadians(d));

Hope it will be helpful to u. Please follow here to learn more.

like image 79
midhunhk Avatar answered Jan 03 '26 11:01

midhunhk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!