前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >源码分享:仿余额宝数字跳动效果 TextCounter

源码分享:仿余额宝数字跳动效果 TextCounter

作者头像
非著名程序员
发布2018-02-08 17:51:37
8090
发布2018-02-08 17:51:37
举报
文章被收录于专栏:非著名程序员非著名程序员

1、TextCounter 效果


2、TextCounter 说明


每次打开余额宝第一件事情就去看看有多少钱,最炫的就是看着钱在跳动相当的舒服,今天放出这个效果。

温馨提示:支持的Android版本最低的是Android 4.0.0 IceCreamSandwich ( API等级14 )

3、TextCounter 使用


例子列表:

Xml 中的使用方法

Java 中的使用方法

Xml 中的使用方法:

<com.github.premnirmal.textcounter.CounterView

 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginBottom="20dp"
 android:textSize="30dp"
 android:textColor="@color/orange"
 counter:autoStart="true"
 counter:startValue="100"
 counter:endValue="5000"
 counter:incrementValue="100"
 counter:timeInterval="2"
 counter:prefix="$"
 counter:suffix=" moneys"
 counter:type="integer | decimal | both"
        />

Java 中的使用方法:

final CounterView counterView = new CounterView(context);

counterView.setFormatter(new Formatter() {
 @Override
 public String format(String prefix, String suffix, float value) {
 return prefix 
 + NumberFormat.getNumberInstance(Locale.US).format(value) 
 + suffix;
 }
});
counterView.setAutoStart(false);
counterView.setStartValue(200f);
counterView.setEndValue(1000f);
counterView.setIncrement(5f); // the amount the number increments at each time interval
counterView.setTimeInterval(2); // the time interval (ms) at which the text changes
counterView.setPrefix("You have ");
counterView.setSuffix(" points!");
counterView.start(); // you can start anytime if autostart is set to false

4、TextCounter 下载


原文链接:仿余额宝数字跳动效果 TextCounter,(http://apkdemo.com/textcounter.html)转发请注明来源!

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2015-11-27,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 非著名程序员 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档