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