[Android]自定义View带效果的滚动数字
@Author GQ 07月29日 一个可以让数字滚动的View,可以自定义参数,是想要的那种效果!
原文github地址
效果图
Android自定义View带效果的滚动数字 效果图AndroidStudio使用使用1. AndroidStudio使用
dependencies {compile 'com.robinhood.ticker:ticker:1.0.1'}
2. 使用
JAVA 代码tickerView = (TickerView) findViewById(R.id.tickerView);//tickerView.setCharacterList(TickerUtils.getDefaultNumberList());//纯数字tickerView.setCharacterList(TickerUtils.getDefaultListForUSCurrency());//可以有小数点,"/"字符tickerView.setAnimationInterpolator(new DecelerateInterpolator());tickerView.setTypeface(Typeface.MONOSPACE);tickerView.setText("$" + Double.toString(number));//显示//如果想显示字母请查看原github上的demo
XML
<com.robinhood.ticker.TickerViewandroid:id="@+id/tickerView"android:layout_width="wrap_content"android:layout_height="wrap_content"android:gravity="center"android:textColor="@color/colorPrimary"android:textSize="18sp"app:ticker_animationDuration="800"/>