4

Does anyone have any ideas on how to create a rotating control? Something that looks like this: http://www.raywenderlich.com/9864/how-to-create-a-rotating-wheel-control-with-uikit

I came across 2 blog posts which is pretty close to what I need but, not quite:

http://mindtherobot.com/blog/534/android-ui-making-an-analog-rotary-knob/ and http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-a-rotating-dialer/

The first one doesn't really animate when rotating, and while the second one does animate, it uses one large bitmap and rotates it. Because the control I'm looking for should actually be container for a few buttons (they each need to react to clicks), I can't really use one large bitmap.

Sevle
  • 3,109
  • 2
  • 19
  • 31
ebernie
  • 820
  • 1
  • 8
  • 13

3 Answers3

3

up to API 10 , animation works in a very weird way so that if you rotate/move/scale views , their real position/rotation/size doesn't really change . if you don't mind about that , you can simply use a rotation-Animation , similar to this: https://stackoverflow.com/a/4846255/878126

Community
  • 1
  • 1
android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • I also need it to rotate when the user rotates it via touch. I guess I could wire up the animations to a gesture listener (if anyone thinks if this is cannot be done, please let me know). Any idea how I would go about positioning the individual controls in a circular path? – ebernie May 07 '12 at 03:38
  • this is something that requires a customized layout. maybe try to extend RelativeLayout or FrameLayout , and just decide where to put and measure each view. – android developer May 07 '12 at 07:14
  • Animation in android really makes you want to cry sometimes. I've tried 3 different approaches making a rotating wheel and now I've come to the conclusion that rotation can be done simple but rotation with buttons need to be handled by capturing where the touch is and then match that touch area with where the image of the buttons are. – Warpzit Jun 05 '12 at 09:32
  • yes , well , if you use the animations of android 3 or 4 , you will much easier life with it . otherwise , i would recommend checking out third party opengl libraries (maybe libgdx or andengine) . – android developer Jun 05 '12 at 13:20
0

I've just deployed an open source dial library: you can check it out at: https://bitbucket.org/warwick/hgdialrepo or watch the video at: https://www.youtube.com/watch?v=h_7VxrZ2W-g&t It's a very sophisticated library with many usage scenarios and great features.

user2288580
  • 2,210
  • 23
  • 16
0

Have tried this one https://github.com/R4md4c/AndroidRotaryWheelView. This is quite similar to your requirement.

Adarsh Yadav
  • 3,752
  • 3
  • 24
  • 46