Monday 2 July 2012

Custom Wheel Widget.

Android provides a DatePicker widget, but not an iPhone-like. The android-wheel project helps in building similar components, with a range of controls.
To build a widget using android-wheel, the project should be checked out from SVN and be referenced as an android library. The google project contains 'wheel' and 'wheel-demo' modules.
Quick Notes On The Widget
Package : kankan.wheel.widget is the base package.
View : WheelView is the View class that creates the wheel.
Listeners : OnWheelChangedListener, OnWheelScrollListener, OnWheelClickedListener support wheel actions like onChanged, onScrollingStarted, onScrollingFinished & onItemClicked.
Adapter(s) :
  • WheelViewAdapter is the adapter interface for the wheel items.
  • NumericWheelAdapter is a concrete implementation to support numeric values.
  • ArrayWheelAdapter<T> is a concrete implementation to support <T>
  • Custom implementations of WheelViewAdapter can be written using AbstractWheelTextAdapter. 

    Screen Shot:  
     

     

10 comments:

  1. Wow! Thank you for your post! It's very very helpful!

    ReplyDelete
  2. Hi,

    Got 404, while i tried to get source code...

    ReplyDelete
  3. Hi,

    Got 404, while I tried to get source code!!!

    ReplyDelete
  4. https://code.google.com/p/android-wheel/

    ReplyDelete
  5. Do you have a version set up for Android Studio? I imported the code and, eventually, got it to work, but for some reason the size is way off (much too small of a wheel). Looks like the WheelView calculateLayoutWidth. The widthSize is correct, but the value being returned is much too small.

    ReplyDelete