In the Android Apidemo, there is a button merry-go effect, but the change is TextView, or a little difference.
Define MERRY-GO (Marquee), mainly in Project/res/layout/main.xml
Copy Code code as follows:
<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 of the layout_width set is shorter than the length of the text, that is, layout_width display incomplete text will have a merry-go effect (2) ellipsize that the affirmation of the use of Merry-go Marquee
(3) Singleline represents a single line display
(4) Marqueerepeatlimit indicates the number of merry-go displayed: marquee_forever-Unlimited uninterrupted display
Copy Code code as follows:
<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>
Where @string/textmarquee is defined as a string of/res/valuse/strings.xml