Android Studio 制作一个循环播报的效果

  这个就是用到了一个TextView 控件,直接上代码。

 1 <TextView
 2         android:id="@+id/tv_7"
 3         android:layout_width="match_parent"
 4         android:layout_height="wrap_content"
 5         android:text="熟能生巧,业精于勤。"
 6         android:textSize="20sp"
 7         android:textColor="@color/colorBlue"
 8         android:singleLine="true"
 9         android:ellipsize="marquee"
10         android:marqueeRepeatLimit="marquee_forever"
11         android:focusable="true"
12         android:focusableInTouchMode="true"
13         android:layout_alignParentBottom="true"/>

  这里singleLine设置为单行

  ellipsize这只他为当显示不下的时候以 ... 代替

  marqueeRepeatLimit 设置循环次数

  

   1 android:focusable="true" 2 android:focusableInTouchMode="true"  

  聚焦一下,这两行必须要有

原文地址:https://www.cnblogs.com/yandashan666/p/10419021.html