How To Create a Rotating Wheel Control?

AkashG picture AkashG · Apr 19, 2012 · Viewed 30.7k times · Source

I am trying to implement the Rotatory wheel in android, just like the image displayed below.I came across the tutorial from this link. But i want to implement just as shown in the below image.The wheel consists of individual images.Does anybody have any idea regarding this implementation?? Any help would be appreciated.

enter image description here

Thanks in advance.

Akash

Answer

AkashG picture AkashG · Jul 5, 2012

Applied on OnTouchListener on the imageView through which i got three events namely:

  1. MotionEvent.ACTION_DOWN,
  2. MotionEvent.ACTION_MOVE &
  3. MotionEvent.ACTION_UP.

On MotionEvent.ACTION_DOWN got the angle where the users touches and on MotionEvent.ACTION_UP got the angle where user releases.

After getting difference of the two angles,rotated the image of that angle.

After rotating the image checked the quadrant through angle and maintained int variable which incremented according to the quadrant and by fulfilling the condition set the new image(the desired one).

Maintained the click event according to the value of the int variable.