Code Monkey home page Code Monkey logo

luckywheel's Introduction

Screenshot

Example Image

Usage

Include LuckyWheel widget in your layout:

<rubikstudio.library.LuckyWheelView
    android:layout_centerInParent="true"
    app:lkwBackgroundColor="#FF9800"
    app:lkwTopTextColor="#263238"
    app:lkwCenterImage="@drawable/wheel2"
    app:lkwCursor="@drawable/ic_cursor"
    android:id="@+id/luckyWheel"
    android:layout_width="300dp"
    android:layout_height="300dp" />

You also have the option to add the following parameters:

...
        app:lkwEdgeColor="#e2e5eb"
        app:lkwEdgeWidth="25"
        app:lkwTopTextPadding="10dp"
        app:lkwTopTextSize="12sp"
        app:lkwSecondaryTextSize="25sp" />

And in your code :

LuckyWheelView luckyWheelView = (LuckyWheelView) findViewById(R.id.luckyWheel);
List<LuckyItem> data = new ArrayList<>();
for (int i=0; i<12; i++) {
    LuckyItem luckyItem = new LuckyItem();
    luckyItem1.topText = "Item " + i;
    luckyItem1.icon = R.drawable.test;
    luckyItem1.color = 0xffFFF3E0;
    data.add(luckyItem);
}

luckyWheelView.setData(data);
luckyWheelView.setRound(10);

// start
luckyWheelView.startLuckyWheelWithTargetIndex(index);

// listener after finish lucky wheel
luckyWheelView.setLuckyRoundItemSelectedListener(new LuckyWheelView.LuckyRoundItemSelectedListener() {
    @Override
    public void LuckyRoundItemSelected(int index) {
        // do something with index
    }
});

#Custom LuckyWheel

You can setting these properties of the lucky wheel view with xml :

    app:lkwBackgroundColor="#FF9800"
    app:lkwTopTextColor="#263238"
    app:lkwCenterImage="@drawable/wheel2"
    app:lkwCursor="@drawable/ic_cursor"

Or with code like:

    luckyWheelView.setLuckyWheelBackgrouldColor(0xff0000ff);
    luckyWheelView.setLuckyWheelTextColor(0xffcc0000);
    luckyWheelView.setLuckyWheelCenterImage(getResources().getDrawable(R.drawable.icon));
    luckyWheelView.setLuckyWheelCursorImage(R.drawable.ic_cursor);

#Sample Check out the sample application to see it in action!

Contributing

Contributions welcome via Github pull requests.

luckywheel's People

Contributors

thanhniencung avatar buutqn avatar peterbetos avatar kagile avatar nvkien avatar

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.