Android实现TextView字符串波浪式跳动
来源:互联网 发布:mysql怎么修改数据库名 编辑:程序博客网 时间:2024/06/05 22:32
Android实现TextView字符串波浪式跳动
在github上有一个开源项目:JumpingBeans,其项目主页是:https://github.com/frakbot/JumpingBeans
JumpingBeans将一个普通的Android TextView中显示的字符串可以做到波浪式跳动。JumpingBeans使用起来简单,仅仅在Android的Java代码中将一个普通Android TextView加载即可:
package zhangphil.demo;import android.app.Activity;import android.os.Bundle;import android.widget.TextView;import net.frakbot.jumpingbeans.JumpingBeans;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);// 增加跳动的点final TextView textView1 = (TextView) findViewById(R.id.textView1);JumpingBeans jumpingBeans1 = JumpingBeans.with(textView1) .appendJumpingDots() .build();// 从第一个字符串到最后一个字符串波浪式循环跳动final TextView textView2 = (TextView) findViewById(R.id.textView2);JumpingBeans jumpingBeans2 = JumpingBeans.with(textView2) .makeTextJump(0, textView2.getText().length()) .setIsWave(true) .setLoopDuration(3000) .build();}}
布局文件中仅仅有两个普通的Android TextView:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="zhangphil.demo.MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="100dip" android:gravity="center" android:text="Zhang Phil @ CSDN" android:textSize="20sp" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="100dip" android:gravity="center" android:text="Zhang Phil @ CSDN" android:textSize="20sp" /></LinearLayout>
结果如图所示:
0 0
- Android实现TextView字符串波浪式跳动
- TextView字符串波浪式跳动--第三方开源---JumpingBeans
- 基于canvas实现波浪式绘制图片
- Android实现跳动的小球加载动画效果
- Android TextView实现超链接
- 让你的TextView字体跳动起来
- [JS]实现页面时间跳动
- Android TextView实现滚动效果
- [Android] TextView实现走马灯效果
- android--TextView实现跑马灯
- Android textview实现删除线
- [Android] TextView实现走马灯效果
- android 实现textView的走马灯
- Android TextView实现滚动条
- Android textview实现删除线
- android 继承textview 实现 刮刮开
- android TextView自动实现省略号
- Android 查看更多 TextView实现
- REST API 安全设计指南
- Caused by: java.io.FileNotFoundException: dbcpconfig.properties (No such file or directory)
- AppStore被拒的一些原因
- 贪吃蛇(2)
- iOS开发学习之触摸事件和手势识别
- Android实现TextView字符串波浪式跳动
- 贪吃蛇(3)
- OC中类属性的封装方法和类的初始化
- SSH的正向连接和反向连接
- C语言求数组元素中的最小值
- 安卓学习笔记一 —— Activity的一些使用技巧
- SYBASE全库备份方案
- Noip2015总结
- iOS开发学习之触摸事件和手势识别