安卓跑马灯的实现

来源:互联网 发布:python换两行 编辑:程序博客网 时间:2024/06/15 19:25

实现:实现了一个类,继承TextView,重写isFocused方法,返回值true,欺骗系统,该TextView获取了到了焦点。应为只有TextView获取到了焦点才能实现跑马灯的效果

<com.zw.ui.FocusedTextView

       android:layout_width="match_parent"

       android:layout_height="wrap_content"

       android:ellipsize="marquee"

       android:singleLine="true"

       android:text="好消息,好消息,走过路过不要错过,大家伙赶紧来玩"

       android:textColor="#000000"

        android:textSize="18sp" />
0 0