滚动的View既字体的滚动循环.
1.android:focusableInTouchMode="true" //设置是否为滚动
android:ellipsize="marquee" //设置为循环的滚动
但是对于TextView 它默认为False 所以是不可滚动的
所以 写个自定义的类来继承TextView
实现其中的几个方法
写IsFocued 方法 将返回值设置为True
@Override
@ExportedProperty(category = "focus")
public boolean isFocused() {
// TODO Auto-generated method stub
return true; //欺骗系统
}
2.在实现的XML文件中调用就可以了
<TextView.MyTextView
android:focusableInTouchMode="true"
android:ellipsize="marquee"
android:id="@+id/tv"
android:textSize="10dp"
android:text="我是360卫士我是360卫士我是360卫士我是360卫士我是360卫士我是360卫士我是360卫士我是360卫士我是360卫士我是360卫士11111111111111"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"/>
3.即可实现文字的滚动功能了