Android textView 滚动
来源:互联网 发布:淘宝贷款额度可以作假 编辑:程序博客网 时间:2024/05/21 22:55
Textvie滚动效果
1.第一种方式 <!-- singleLine : 一行显示 ellipsize none :省略后面文字 start : 隐藏前面的文字 middle : 隐藏中间的文字 end : 隐藏后面的文字 marquee : 滚动 focusableInTouchMode : 触摸获取焦点 TextView天生是没有点击事件和获取焦点的事件 focusable : 是否获取焦点操作,true:可以 false:不可以 marqueeRepeatLimit : 设置滚动次数,marquee_forever : -1 一直滚动 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="aaassss" android:singleLine="true" android:ellipsize="marquee" android:focusableInTouchMode="true" android:focusable="true" android:marqueeRepeatLimit="marquee_forever" />2.第二种方式,自定义一个textview,让textview自动获取焦点 a.创建自定义控件,继承textview public class HomeTextView extends TextView { //在代码中使用的调用 public HomeTextView(Context context) { super(context); } //在布局文件中使用的时候调用,比两个参数多了样式 public HomeTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } //在布局文件中使用的时候调用 //布局文件中的控件都是可以用代码来表示 //AttributeSet : 保存了控件在布局文件中的所有属性 public HomeTextView(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } //设置自定义的textview自动获取焦点 //是否获取焦点 @Override public boolean isFocused() { //true:获取焦点,false:不获取焦点 return true; } } b.再布局文件中使用 <com.itheima.mobliesafe75.ui.HomeTextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="1112223333" android:singleLine="true" android:ellipsize="marquee" android:focusableInTouchMode="true" android:marqueeRepeatLimit="marquee_forever" />
0 0
- Android TextView滚动效果
- TextView 滚动效果 android
- android textview 滚动条
- android textview 手动滚动
- android-----------textview -------------滚动
- android textview 水平滚动
- android滚动TextView设计
- Android TextView滚动效果
- Android TextView文字滚动
- android textView 上下滚动
- Android Textview的滚动
- Android textView 滚动
- Android金钱滚动效果-滚动的textView
- Android - 自动文字滚动TextView
- Android TextView 垂直自动滚动
- Android TextView实现滚动效果
- Android TextView横向滚动问题
- Android TextView的双向滚动
- 数据库查询优化
- Hadoop 架构简介
- 解释型语言和编译型语言的区别
- java-实时打印当前线程的调用堆栈
- 对于App快速开发方法的统计
- Android textView 滚动
- 常见Java问题答疑及笔试题(十六)——华为2016研发笔试
- gradle+spring-boot+mybatis(基于xml)+mysql 整合
- List的实现
- python使用MySQLdb报an integer is required
- java菜鸟初入职场
- Centos下Mysql之Mycat初体验
- Azkaban 3.X 安装
- 文言字词的理解 —— 然、动词、时间地理概念