<TextView
android:text="@string/hello"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/button"
android:layout_toStartOf="@+id/button"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:maxLines="1" />
如需实现两个textview同时实现跑马灯效果则需:自定义一个textview的子类,并实现
@override
public boolean isFocused(){
return true;
}
并在xml中通过包名加类名调用自定义textview子类。