Android Interface (1) use TextView to achieve a marquee effect

Source: Internet
Author: User
Method One: (can only achieve a single textview of the marquee effect)
In TextView add the following controls android:singleline= "True" can only be a single line, the excess text appears as "..." android:ellipsize= "marquee" ellipsis no, but no marquee effect Android: Focusable= "true" android:focusableintouchmode= "true" method two: (can achieve multi-line TextView of the marquee effect) custom A class inherits TextView, implements the default three kinds of constructors, Override the IsFocused () method to return true to change TextView in the layout file (package name + Class name) Com.imooc.marqueetextviewdemo.MarqueeText parsing: Method Two of the two TextView are able to achieve the marquee effect is because the rewritten isfocused () method returns True, Forcing the TextView to focused; In method one, the first TextView gets the focus, and the second TextView does not have the focus and does not achieve the marquee effect problem: Scrolling will stop itself after a while: Android: marqueerepeatlimit= "Marquee_forever" TIPS:PX,DP (DIP), SP1. The use of PX,PX is not recommended in development, and the 2.DP and SP can be scaled according to the resolution; 3. It is recommended to use DP,SP more for displaying text size;4 when making a length size limit in the control. DP is recommended in the latest Android SDK

Android Interface (1) use TextView to achieve a marquee effect

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.