Set TextView and Button of Marquee effect example in android

  • 2020-05-10 18:51:04
  • OfStack

In Android's ApiDemo, there is Button's go-around effect, but there is still a difference between TextView and TextView.
Definition version (Marquee), mainly in Project res/layout/main xml can
 
<SPAN style="COLOR: #993300"><TextView 
android:layout_width="40px" 
android:layout_height="wrap_content" 
android:text="Test marquee for TextView" 
android:layout_gravity="center" 
android:ellipsize="marquee" 
android:singleLine="true" 
android:focusable="true" 
android:marqueeRepeatLimit="marquee_forever" 
android:focusableInTouchMode="true" 
android:scrollHorizontally="true" 
/></SPAN> 

Key points:
(1) the length set by layout_width should be shorter than the actual length of text, that is, layout_width does not show text completely. (2) ellipsize declares the use of marquee
(3) singleLine represents a single line display
(4) marqueeRepeatLimit refers to the number of times the revolving light is displayed: marquee_forever- unlimited uninterrupted display
 
<SPAN style="COLOR: #993300"><Button 
android:id="@+id/buttonMarquee" 
android:layout_width="320px" 
android:layout_height="wrap_content" 
android:text="@string/textMarquee" 
android:singleLine="true" 
android:focusable="true" 
android:selectAllOnFocus="true" 
android:ellipsize="marquee" 
android:marqueeRepeatLimit="marquee_forever" 
/></SPAN> 

The @ string/textMarquee res/valuse/strings xml defined string

Related articles: