只需要在TextView中添加一些属性即可:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!-- 实现的属性:ellipsize、focusable、focusableInTouchMode、singleLine --> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="20dp" android:textColor="#9C27B0" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:singleLine="true" android:gravity="center" android:text="www.cnblogs.com/zzw1994 www.cnblogs.com/zzw1994" android:textSize="30sp" /> </LinearLayout>