custom widget--srcoll number
Java
Latest commit 81322d6 Jul 25, 2016 @a-voyager committed on GitHub Merge pull request #4 from jp1017/master
add setting.gradle
Permalink
Failed to load latest commit information.
app update 'setTextFont' Jul 22, 2016
gradle/wrapper initial commit. Jul 15, 2016
imgs update readme. Jul 22, 2016
library update 'setTextFont' Jul 22, 2016
README.md update readme. Jul 22, 2016
README_zh.md update readme. Jul 22, 2016
build.gradle fix Gradle. Jul 22, 2016
gradle.properties initial commit. Jul 15, 2016
gradlew initial commit. Jul 15, 2016
gradlew.bat initial commit. Jul 15, 2016
settings.gradle add setting.gradle Jul 25, 2016

README.md

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.