Example of setting up Textview/button merry-go (Marquee) effect in Android _android

Source: Internet
Author: User
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.