This article describes the method of Android to achieve marble effects based on TextView attribute android:ellipsize. Share it for your reference, as follows:
In Android system, TextView must meet the following conditions:
1、android:ellipsize="marquee"
2. TextView must be displayed in a single line, that is, the content must exceed the size of TextView.
3. TextView needs to get focus before it can scroll
XML code:
android:ellipsize="marquee", android:singleLine="true"
Java code:
("Welcome to me https:///, here we provide everyone's script special effects and source code for everyone to download and learn");(true); ();
PS: (true); //Let the text slide horizontally
TextView can also set the number of scrolling times of the marquee effect, as follows:
XML code settings:
android:marquerepeatlimit="1". 1 represents 1 time, -1 represents infinite loop.
Java code settings:
(-1);
For more information about Android related content, please check out the topic of this site:Android development introduction and advanced tutorial》、《Android multimedia operation skills summary (audio, video, recording, etc.)》、《Summary of the usage of basic Android components》、《Android View View Tips Summary》、《Android layout layout tips summary"and"Android control usage summary》
I hope this article will be helpful to everyone's Android programming design.