Android Wheel Widget

This is a simple widget I created as part of the Aviary Editor SDK for Android. It creates a wheel-like widet which can be scrolled in both directions.
The idea was to replace the default slider widget and use a more “real world” component.
Moreover if you’ll add the VIBRATE permission into your AndroidManifest.xml file you’ll have also haptics feedback while the wheel is scrolling:

1
<uses-permission android:name="android.permission.VIBRATE" />

To include the wheel widget in the current layout, you should add in the layout xml this lines:

1
2
3
4
5
6
7
<it.sephiroth.android.wheel.view.Wheel
android:id="@+id/wheel"
xmlns:sephiroth="http://schemas.android.com/apk/res/it.sephiroth.android.wheel"
android:layout_width="match_parent"
android:layout_height="match_parent"
sephiroth:numRotations="6"
sephiroth:ticks="28" />

Where numRotations is the max number of rotations the wheel can perform and ticks is the total number of ticks the wheel will display.

Then in your activity you can add a OnScrollListener listener to the wheel widget, in this way:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mWheel = (Wheel) findViewById( R.id.wheel );
mWheel.setOnScrollListener( new OnScrollListener() {

@Override
public void onScrollStarted( Wheel view, float value, int roundValue ) {
}

@Override
public void onScrollFinished( Wheel view, float value, int roundValue ) {
}

@Override
public void onScroll( Wheel view, float value, int roundValue ) {
}
} );

You can download the source at the gihub project page.

  • watch porn

    great post and informatin. thanx. http://www.pornvideoswatch.net

  • http://twitter.com/KIKI_JIKI 鏡割りのキキジキ

    Thank you, it works great!
    I wanted to ask, how can I set the wheel to a certain value from the code? (like a setValue(x) )
    I tried to edit some values but as soon as the wheel gets scrolled again, it gets back to the original value.

  • http://www.facebook.com/tytgadt Patrick Tytgadt

    Perfect!!!
    I`m using it everyday.
    http://www.megtur.com.br

  • leto

    Hi,
    is it possible to rotate the wheel by 90°? I made it smaller by modifying the linear layout which enclose it but I don’t know hot to rotate it. With android:rotation=”90″ it rotates in the graphical layout view but not in the real app.
    Would be great if you could help me.

  • dkps

    Hey,

    This looks interesting, but it seems the namescape doesn’t work anymore? When I paste it into my layout.xml file, I get two errors stating: “No resource identifier found for attribute ‘ticks’/’numRotations’ in package ‘it.sephiroth.android.wheel’

    Is the ns still up?
    Thanks :)

  • anon

    what about the license???

  • Stephan Wiesner

    I have the same problems as some other users. Your demo does not work either .-(

    https://github.com/sephiroth74/AndroidWheel/issues/2