Android Self-paced notes for multiple TextView marquee implementations

Source: Internet
Author: User

TextView Marquee Realization:
1. Define the 4 properties of the TextView tag:
Android:singleline= "true"//make it only one line
Android:ellipsize= "marquee"//Remove Ellipsis
Android:focusable = "true"//Make it loop

Android:focusableintouchmode = "true"

Such a textview realization of the marquee effect, but if the same way to write the second TextView, the actual operation of the second TextView is not effective will only be like ordinary textview, the following we say the solution:



2. Custom class inheritance TextView:
implementation of three constructors;

Replication Isfocued method, return True (default has focus, usually only one has focus on the first row)

@Override
public Boolean isFocused () {
return true;
}

In the end, we activity_main.xml our custom classes to replace TextView.

3. Use a custom class by using the package name and custom class name instead of TextView (package name + class name under SRC)


To achieve the result of the marquee.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Self-paced notes for multiple TextView marquee implementations

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.