以编程方式使用,而不是从xml:
textView.setSingleLine(true);
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setFocusableInTouchMode(true);
textView.setFreezesText(true);
textView.setMarqueeRepeatLimit(-1);
textView.setFocusable(true);
textView.setSelected(true);
对于xml,您可以使用:
<TextView
android:id="@+id/tVMessage"
style="@style/tVMessage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textDirection="anyRtl"
android:singleLine="true"
android:text="Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye Good bye" />
在xml中使用单行。