Code Monkey home page Code Monkey logo

scrollnumber's Introduction

Scroll Number Widget

中文 | English

A SimpleGracefulEasy-to-Use Scroll Number Widget!

Don't forget give me a star :)

Feature

  • Just need to call setNumber() could be performed.
  • You can dynamically customize number's colors、size、range、font...

image

Dependency

There are two ways:

  • clone this project, and use as dependency
  • just add following code to you build.gradle:
compile 'top.wuhaojie:scrollnumber:1.0.0'

Usage

  • Add this to your layout xml file:
<top.wuhaojie.library.MultiScrollNumber
    android:id="@+id/scroll_number"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>
  • Call setNumber() in your java code:
MultiScrollNumber scrollNumber = (MultiScrollNumber) findViewById(R.id.scroll_number);
scrollNumber.setNumber(2048);

Customize

  • Color Call setTextColors(@ColorRes int[] textColors) with a paramiter, a array stores colors from High bit to Low bit.
scrollNumber.setTextColors(new int[]{R.color.blue01, R.color.red01,
                R.color.green01, R.color.purple01});

image

  • Size Just call setTextSize(int textSize) with the size you want to change to, unit is sp .
scrollNumber.setTextSize(64);

image

  • Range Call setNumber(int from, int to) instead of setNumber(int val) to specify a range.
scrollNumber.setNumber(64, 2048);

image

  • Interpolator You could change interpolator with call setInterpolator(Interpolator interpolator).
scrollNumber.setInterpolator(new DecelerateInterpolator());
  • Font Change text font by call setTextFont(fileName), before this you should copy the font file to assets/ directory.
scrollNumber.setTextFont("myfont.ttf");

image

Xml

Meaning Attribute
from a number primary_number
to a number target_number
number size number_size

Update Log

  • add font change option on 22/7/2016.

License

The MIT License (MIT)

Copyright (c) 2015 WuHaojie

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

scrollnumber's People

Contributors

a-voyager avatar jp1017 avatar

Watchers

James Cloos avatar Forrest 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.