TextView自定义跑马灯效果
2016-07-05 14:17
435 查看
在复杂的布局中想要使用跑马灯效果需要自己自定义TextView,因为有可能在复杂的布局中原来的TextView获取不到焦点,就不会有效果
解决方法:
自己重写TextView:
解决方法:
自己重写TextView:
public class MarqueeTextView extends TextView { public MarqueeTextView(Context context) { super(context); } public MarqueeTextView(Context context, AttributeSet attrs) { super(context, attrs); } public MarqueeTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public boolean isFocused() { return true; } }
<***.MarqueeTextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="12dp" android:paddingLeft="12dp" android:paddingRight="12dp" android:text="234254fadfadffadfadfgfhdgfhjhfjhfjhjfhjfhjfhjfhjtyteytryetaaaa" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" android:textColor="@color/white" android:ellipsize="marquee" android:focusableInTouchMode="true" android:focusable="true" />
相关文章推荐
- servlet学习
- handler 多线程的排列设置
- 灵活且强大的RecyclerViewAdapter源码分析
- delphi设计浮动窗口
- 单例模式PHP
- Java异常处理和设计
- Exchange server 2010手动白名单设置
- CSS的注释与继承
- 数据库设计原则(转载)
- java this 子类调父类,父类再调用子类已覆盖的方法及属性(又一次理解)
- JVM的内存区域划分
- Matlab 中 set(h, 'ButtonDownFcn',@buttonDownCallback)
- mislider.js 超酷响应式圆形图片轮播图插件
- Stopwatch 计时器类
- css-float,clear
- 前端性能优化:jquery的each为什么比原生的for循环慢很多?
- 浅谈Java中的hashcode方法
- android环境搭建有感
- golang实现base62编码
- AfxEndThread导致内存泄露