textview 无需焦点无限跑马灯效果
来源:互联网 发布:mac迅雷下载速度为0 编辑:程序博客网 时间:2024/04/29 07:51
前言:这是我第一次写博客也不知道说些什么,主要是记录下开发过程中遇到的问题。也是搜索了广大大神们的解决办法,自己归纳后分享希望能帮助到像我一样 的新手。关于android方面我自己也是刚入门的新手,如有幸有大神看到我的博客希望多多指点。在此谢过!!
言归正传:textview 无需焦点无限跑马灯效果主要是解决小部分的碎片化问题。
1.
首先,写一个类,让其继承自TextView:
public class MarqueeText extends TextView {public MarqueeText(Context con) { super(con);}public MarqueeText(Context context, AttributeSet attrs) { super(context, attrs);}public MarqueeText(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle);}@Overridepublic boolean isFocused() {return true;}@Overrideprotected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { }}
2.
<!-- 在布局文件中用自己写的控件只需要写类的全名就行,如下com.example. 这是包名,后面再跟类名就行了 -->
<com.example.MarqueeText android:id="@+id/AMTV1" android:layout_width="400dip" android:layout_height="wrap_content" android:layout_marginLeft="80dip" android:textSize="25sp" android:textColor="@android:color/black" android:lines="1" android:focusable="true" android:focusableInTouchMode="true" android:scrollHorizontally="true" android:singleLine="true" android:marqueeRepeatLimit="marquee_forever" android:ellipsize="marquee" android:background="#2FFFFFFF" android:text="这才是真正的文字跑马灯效果,文字移动速度,文字移动方向,文字移动的样式,动画等等……" />注意:4.0以上系统版本中,需要对view添加android:singleLine="true"属性
0 0
- textview 无需焦点无限跑马灯效果
- 无需焦点的跑马灯TextView
- TextView垂直方向无限滚动还有跑马灯效果
- TextView的跑马灯效果,还有焦点问题
- TextView实现跑马灯效果(不获取焦点)
- Textview自定义跑马灯效果 不受其他焦点影响
- TextView实现跑马灯效果,不用获取焦点
- 不持有焦点的跑马灯效果TextView
- TextView跑马灯效果
- TextView跑马灯效果
- TextView跑马灯效果
- TextView跑马灯效果
- TextView跑马灯效果
- TextView跑马灯效果
- TextView 跑马灯效果
- TextView 跑马灯效果
- TextView跑马灯效果
- TextView跑马灯效果
- iCCP: Not recognizing known sRGB profile
- 《leetCode》:House Robber
- JAVA中的集合的概念
- Android 开发资料整理
- 如何使用gyp管理c++工程(ubuntu版)
- textview 无需焦点无限跑马灯效果
- 两种方法使用随机存取文件流RandomAccessFile实现根目录下文档内容任意位置的插入。
- 基于层次的聚类----AGNES算法使用(R语言)
- MySQL(3)-MySQL Workbench
- 不具名的命名空间(unnamed namespaces)
- Python基础
- 数组List相互转换
- hdu 2203 亲和串(求一个串轮回后是否包含别的一个串)
- 山东省赛二组合数dp