TextView滚动显示内容

来源:互联网 发布:淘宝预热 编辑:程序博客网 时间:2024/06/10 05:09
<com.gionee.myviews.MyTextView
                android:id="@+id/long_screen_shot_mytextview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:text="@string/long_screen_shot_next_screen"

                android:textSize="12sp" />

注意上面的ellipsize的属性。

还要TextView保持焦点。最简单的方式,就是复写TextView的isFocus()方法。TextView会在滚动期间不断调用这个方法。一定要是TextView有焦点,而不是其父控件或者Window。当然要view有焦点,首先Window要有焦点。


0 0
原创粉丝点击