[Android1.5]TextView跑马灯效果
from: http://www.cnblogs.com/over140/archive/2010/08/20/1804770.html
前言
这个效果在两周前搜索过,网上倒是有转载,可恨的是转载之后本人有测试过?!N多人都在后面跟帖没效果! 后来没办法临时用定时器来刷的。
文章
1. Ellipsize not working for textView inside custom listView
2. ScrollTextView - scrolling TextView for Android
声明
欢迎转载,但请保留文章原始出处:)
博客园:http://www.cnblogs.com
农民伯伯: http://www.cnblogs.com/over140/
正文
本文得益于文章1的提示,虽然没全看明白,但是看见代码就复制下来然后测试,果然给我撞出来了- - #。
一、效果图

二、实现代码:

android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:ellipsize="marquee"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
android:focusableInTouchMode="true"
android:scrollHorizontally="true"
android:text="这才是真正的文字跑马灯效果"
>
</TextView>

代码说明:
a). 经测试与转载文章区别主要在于这里有设置android:focusableInTouchMode
b). 测试环境为Android1.5、模拟器。
三、后期维护
3.12013-07-01
本博后续文章:【Android】不依赖焦点和选中的TextView跑马灯
结束
出来写文章,即使是转载也得负责。文章2为自定义控件,大家可以参考一下。
方法1
android:singleLine="true"
android:ellipsize="marquee"
android:focusableInTouchMode="true"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
方法2
集成TextView, 重写方法
@Override
public boolean isFocused() {
// TODO Auto-generated method stub
return true;
}
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
[Android1.5]TextView跑马灯效果的更多相关文章
- TextView跑马灯效果
转载:http://www.2cto.com/kf/201409/330658.html 一.只想让TextView显示一行,但是文字超过TextView的长度怎么办?在开头显示省略号 android ...
- Android学习总结——TextView跑马灯效果
Android系统中TextView实现跑马灯效果,必须具备以下几个条件: 1.android:ellipsize="marquee" 2.TextView必须单行显示,即内容必须 ...
- 【Android】TextView跑马灯效果
老规矩,先上图看效果. 说明 TextView的跑马灯效果也就是指当你只想让TextView单行显示,可是文本内容却又超过一行时,自动从左往右慢慢滑动显示的效果就叫跑马灯效果. 其实,TextView ...
- Android TextView 跑马灯效果 - 2018年6月19日
第一步在布局中添加加粗部分代码: <TextView android:id="@+id/tv_company" android:layout_width="0dp& ...
- android 设置textview跑马灯效果
head_tv1.setEllipsize(TextUtils.TruncateAt.MARQUEE);head_tv1.setSingleLine(true);head_tv1.setSelecte ...
- TextView标签的属性和跑马灯效果
text:显示的内容 textSize:文本的大小 textColor:文本的颜色 visibility:可见性 默认可见,invisible:表示不可见,但对控件的显示区域做了保留 gone:隐藏 ...
- 设置TextView的密码效果以及跑马灯效果
密码效果以及跑马灯效果: xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...
- TextView 实现跑马灯效果
在String.xml中添加: <string name="txt">跑马灯效果,我跑啊跑</string>在layout/mian.xml中添加TextV ...
- Android界面(1) 使用TextView实现跑马灯效果
方法一:(只能实现单个TextView的跑马灯效果)在TextView添加以下控件 android:singleLine="true"只能单行,超出的文字显示为"...& ...
随机推荐
- codeforces 385C Bear and Prime Numbers 预处理DP
题目链接:http://codeforces.com/problemset/problem/385/C 题目大意:给定n个数与m个询问区间,问每个询问区间中的所有素数在这n个数中被能整除的次数之和 解 ...
- lightoj1017 dp
题目链接:http://lightoj.com/volume_showproblem.php?problem=1017 #include <cstdio> #include <cst ...
- git submodule的操作
对于有submodule的库,检出的方法是: git clone https://github.com/BelledonneCommunications/linphone-android.git -- ...
- Installing scikit-learn
Installing scikit-learn http://scikit-learn.org/stable/install.html Installing scikit-learn There ar ...
- automake---让Makefile变得更专业一点儿
一般我们装软件时,都要运行 ./configure --prefix=/usr/local make make install 看着不断刷新的屏幕,总感觉真得好高深呀,其实我们的程序也可以这样子. 下 ...
- PDO 提供了三种不同的错误处理模式
PDO::ERRMODE_SILENT 此为默认模式. PDO 将只简单地设置错误码,可使用 PDO::errorCode() 和 PDO::errorInfo() 方法来检查语句和数据库对象.如果错 ...
- 分享一个很好看的WPF界面
今天在http://www.iopenworks.com/Products/ProductDetails/Introduction?proID=386 上面看到的,先mark下来...... 地址:h ...
- iozone文件系统测试 与EXCEL 制图
http://www.iozone.org/[root@monitor bin]# ./iozone -a -s 512m -f /usr/test -y -q -Rb /root. -i -i Io ...
- 详解 Spring 3.0 基于 Annotation 的依赖注入实现--转载
使用 @Repository.@Service.@Controller 和 @Component 将类标识为 Bean Spring 自 2.0 版本开始,陆续引入了一些注解用于简化 Spring 的 ...
- 关于struts2中action请求会执行两次的问题
关于struts2中action请求会执行两次的问题 在struts2中发现,调用action中的方法,方法会被执行两次,后来发现调用的方法是get开头的,把它改为其他名称开头的后,就不会执行 ...