TextView attribute android:ellipsize= "marquee" does not take effect for the workaround

Source: Internet
Author: User

Recently in writing their own first app, the process encountered this problem, check a lot of posts, after trying to find that this problem is generally divided into two categories:

1. TextView text value is not changed after assignment, many of the posts said the following wording can be effective:

            <TextViewAndroid:id= "@+id/music_name_tv"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"android:ellipsize= "marquee" "must"android:focusable= "true" "must"Android:focusableintouchmode= "true" "must"Android:lines= "1" "must"Android:text= " My Chinese Heart my Chinese heart my Chinese heart my Chinese heart my Chinese heart my Chinese heart my China heart My Chinese Heart my Chinese HeartAndroid:textcolor= "@color/coloraccent"android:textsize= "15SP" />

2. TextView text dynamic assignment, this time directly written in the layout of the XML is not effective, you need to assign a value to TextView, and then re-set the property in the code again:

     Public Static void Settextmarquee (TextView TextView) {        ifnull) {            textview.setellipsize ( TextUtils.TruncateAt.MARQUEE);            Textview.setsingleline (true);            Textview.setselected (true);            Textview.setfocusable (true);            Textview.setfocusableintouchmode (true);        }    }

Note:

1. The first case has been tested, not on my phone, even if the TextView is not dynamically assigned, still cannot scroll, guess should be system compatibility problem.

2. The second type of validation is OK, and the direct code assignment is recommended.

TextView attribute android:ellipsize= "marquee" does not take effect for the workaround

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.