GithubHelp home page GithubHelp logo

androidwheel's Introduction

Wheel widget for Android

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

        <it.sephiroth.android.wheel.view.Wheel
            android:id="@+id/wheel"
            xmlns:sephiroth="http://schemas.android.com/apk/res-auto"
            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.

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

	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 ) {
		}
	} );

Where float value is a value between -1.0 and 1.0 of the current indicator position and int roundValue is a value between -(ticksnumRotations) and (ticksnumRotations)

###Change the Wheel value The wheel position and value chan be changed programmatically at runtime using the Wheel's method setValue:

public void setValue( float value, boolean fireScrollEvent );
  • value is the new wheel value, a float between -1.0f and 1.0f, where 0.0f it's the center of the wheel.
  • fireScrollEvent: if true, once this method is called the onScrollFinished method will be called.

Screen Shots

Wheel running on ICS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.