https://github.com/a-voyager/ScrollNumber
  
  
    custom widget--srcoll number 
    https://github.com/a-voyager/ScrollNumber
  
        Last synced: 7 months ago 
        JSON representation
    
custom widget--srcoll number
- Host: GitHub
 - URL: https://github.com/a-voyager/ScrollNumber
 - Owner: a-voyager
 - Created: 2016-07-19T18:04:39.000Z (over 9 years ago)
 - Default Branch: master
 - Last Pushed: 2017-07-15T03:07:17.000Z (over 8 years ago)
 - Last Synced: 2024-08-02T01:25:27.878Z (over 1 year ago)
 - Language: Java
 - Size: 585 KB
 - Stars: 806
 - Watchers: 16
 - Forks: 123
 - Open Issues: 5
 - 
            Metadata Files:
            
- Readme: README.md
 
 
Awesome Lists containing this project
- awesome-github-android-ui - ScrollNumber - 简单优雅易用的滚动数字控件 (其他)
 
README
          # Scroll Number Widget
[中文](https://github.com/a-voyager/ScrollNumber/blob/master/README_zh.md) | [English](https://github.com/a-voyager/ScrollNumber/blob/master/README.md)
A **Simple**、**Graceful**、**Easy-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...

## Dependency
There are two ways:
 - clone this project, and use as dependency
 - just add following code to you build.gradle:
 ```groovy
 compile 'top.wuhaojie:scrollnumber:1.0.0'
 ```
## Usage
 -  Add this to your layout xml file:
```xml
```
 - Call `setNumber()` in your java code:
```java
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**.
```java
scrollNumber.setTextColors(new int[]{R.color.blue01, R.color.red01,
                R.color.green01, R.color.purple01});
```

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

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

 - Interpolator
 You could change interpolator with call `setInterpolator(Interpolator interpolator)`.
```java
scrollNumber.setInterpolator(new DecelerateInterpolator());
```
 - Font
 Change text font by call `setTextFont(fileName)`, before this you should copy the font file to `assets/` directory.
```java
scrollNumber.setTextFont("myfont.ttf");
```
 - Animation Velocity
 Call `scrollNumber.setScrollVelocity(v)` to set the animation velocity, number in range of 0 ~ 1000.
```java
scrollNumber.setScrollVelocity(30);
```

## 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.
 - support double or float number, setNumber(double num) 15/7/2017
## 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.