跑马灯效果自定义MarqueeTextView
来源:互联网 发布:清除mac上的个人信息 编辑:程序博客网 时间:2024/05/21 22:26
让TextView 实现 跑马灯效果 还必须设置其他几个属性,
android:ellipsize="marquee"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
TextView类 的完整代码如下 :
/**
* 一个可以一直获取焦点的TextView , 用于制作跑马灯的效果
* @author dcqing
* @time 2016-26-25
*/
public class MarqueeTextView extends TextView {
public MarqueeTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public MarqueeTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MarqueeTextView(Context context) {
super(context);
}
@Override
public boolean isFocused() {
return true;
}
}
布局界面代码如下:
<com.dcqing.test.MarqueeTextView
android:id="@+id/text"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:ellipsize="marquee"
android:singleLine="true"
android:text="p跑马灯效果实现" />
1 0
- 跑马灯效果自定义MarqueeTextView
- MarqueeTextView实现跑马灯效果
- MarqueeTextview(跑马灯)
- 自定义View-跑马灯效果
- TextView自定义跑马灯效果
- 自定义TextView跑马灯效果
- android: 不需要焦点的TextView跑马灯 MarqueeTextView
- android: 不需要焦点的TextView跑马灯 MarqueeTextView
- android: 不需要焦点的TextView跑马灯 MarqueeTextView
- Flex “跑马灯”效果(自定义“跑马灯”控件)
- Flex “跑马灯”效果(自定义“跑马灯”控件)
- 自定义TextView实现跑马灯效果
- 自定义TextView实现跑马灯效果
- 自定义TextView跑马灯效果实例教程
- 自定义UI控件实现跑马灯效果
- 自定义view实现跑马灯效果
- 自定义组件实现跑马灯效果
- 自定义view 实现跑马灯效果
- Jetty创建默认应用配置
- iOS类目、延展和协议
- WEBRTC 线程类
- Fragment demo
- 【redis】常见JedisConnectionException异常分析
- 跑马灯效果自定义MarqueeTextView
- Linux下编译boost库生成 libboost_thread-mt.a 的方法
- Slice:Drop——基于Web的医学影像浏览工具
- 利用FFmpeg将mkv视频转换为H.264
- PDO预处理案例
- 110. Balanced Binary Tree 平衡二叉树(重点!!)
- 3. Longest Substring Without Repeating Characters
- JQ笔记本之attr属性操作(赋值与读取)
- 8、Servlet技术