Code Monkey home page Code Monkey logo

wheelview's Introduction

使用说明

这个库包含两种类型的滚轮:普通滚轮立体滚轮,普通滚轮调用WheelView,立体滚轮调用Wheel3DView。两种滚轮实现原理相同,但显示效果不同。立体滚轮类似IOS时间选择控件,效果如下。

演示

img img

添加依赖

compile 'com.cncoderx.wheelview:library:1.2.7'

使用方法

在xml文件中添加

<com.cncoderx.wheelview.Wheel3DView
    android:id="@+id/wheel3d"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    app:wheelCyclic="true"
    app:wheelEntries="@array/default_array"
    app:wheelItemCount="9"
    app:wheelItemWidth="160dp"
    app:wheelItemHeight="40dp"
    app:wheelTextSize="@dimen/wheel_text_size"
    app:wheelTextColor="@color/wheel_text_color"
    app:wheelSelectedTextColor="@color/wheel_selected_text_color"
    app:wheelDividerColor="@color/wheel_divider_color"
    app:wheelHighlightColor="@color/wheel_highlight_color" />

在java文件中添加

WheelView wheelView = (WheelView) findViewById(R.id.wheel);
wheelView.setOnWheelChangedListener(new OnWheelChangedListener() {
    @Override
    public void onChanged(WheelView view, int oldIndex, int newIndex) {
        CharSequence text = view.getItem(newIndex);
        Log.i("WheelView", String.format("index: %d, text: %s", newIndex, text));
    }
});

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.