Wednesday, June 2, 2010

Wheel UI contol: ideas for the future

The wheel control described in previous posts contains all necessary functionality and is ready for using by other applications.
But I would consider it just as a draft for a real wheel view. It needs to "tune" this control to make it more attractive.
Next are some ideas that I'd like to realize:
  1. Implement the animation like in the original iPhone widget
  2. Add the ability to work not only with numbers. Make it to use Adapters like the ListView.
  3. Make the control to be composed. It should contain as much wheels as necessary, so it will allow to avoid defining a set of the wheels for complex widget, like for password and date time picker widgets from the first post about the wheel widget. It can be used by next way:

     // Get the wheel view
     WheelView picker = (WheelView) findViewById(;
     // Add the hours wheel
     WheelViewSection hours = picker.addSection("hours");
     // Set adapter for hours.
     hours.setAdapter(new NumericAdapter(0, 23));
     // Add the mins wheel
     WheelViewSection mins = picker.addSection("mins");
     // Set adapter for it
     mins.setAdapter(new NumericAdapter(0, 59));
     // Set current values
     Calendar c = Calendar.getInstance();
     // ...
     // Get password view
     WheelView passw = (WheelView) findViewById(;
     // Set count of sections
     // Set numeric adapter for all sections
     passw.setAdapter(new NumericAdapter(0, 9));

  4. Repeat the wheel items when necessary. It means to show the first item after the last one. For example, when user select 59 mins there will be shown the 0 and 1 value below; for hours it can be not used and it can show blank items below the 23 and above the 0 hours.
It's all the ideas that I have at this moment. If you have more ideas please let me know.

See also
    Introduction to the Wheel control
    The Wheel control layouts
    The Wheel control backgrounds
    Scrolling the wheel control

Updated: I've posted sources of the Wheel widget to Google code. Please use this link.


    1. I'd appreciate if you provide us the code.

    2. I've upload it to the Google code -

      Please examine.

    3. wow... terrific.. i learned now how for improve my UI in my DB.

    4. thanks.. I could modify now the codes for my application.. review


    5. Great widget. Are you going to implement the animation in the future?

    6. Yes, it will be implemented soon.

    7. Thank you very much. Your work should be added to Android framework :)

    8. Would really like to see Number 4. implemented, this would increase the possibilites to use this widget to many places!

      Keep up the good work!

    9. Hi Paul,

      I've added this functionality. The wheel looks better now.

    10. Really awesome widget. Keep up the great work. Also really appreciate you sharing your code.

    11. This is awesome, thanks!

    12. Hi Thanks for this post. Code on the specified link is not available.If you can upload it again it will be very much helpful.Or you can mail me on

      Thanks for such great post.

    13. Anonymous,

      Sometimes there can be Google maintenance issues.
      I've observed stats for the android-wheel page, so it definitely is available.

    14. Hi Kankan How can I create a rounded whell just likt urban spoon .They also use your code and prepare this .But I don't understand to create .So can You please help me.Thanks a lot

    15. Maidul,

      Just change the wheel background.

    16. hi Kankan...

      I Can use this Wheel object into my xml file for Android Widget in Home screen ? I Try to use it, but i get a error about inflate it. I Google it about Views in Widget, and i found in the android doc, that widget works with RemoteView, that's need to be included in your Wheel ? Tks !