Summary of implementation methods for Android to realize text vertical scrolling and vertical riding lamp effect

Method 1: use the system control viewflipper:

Layout file:

Background file: warning_ bg.xml

Cut in Animation: slide_ in_ bottom.xml

Cut out animation: slide_ out_ top.xml

Note: if you do not set: Android: autostart = "true" in the layout file, you can dynamically set the start loop mviewflipper. Startflipping() in the code;

The display is normal in the activity, but there may be ghosting in the fragment.

Method 2. Use the tripartite framework

Gradle:

attribute

XML

Set string list data

Set string data

Set event listening

For ghosting problems, refer to the following solutions

Note: this library mainly inherits viewflipper. Similar libraries include marqueeviewlibrary. The implementation method is basically similar. The display in activity is normal, but ghosting may occur in fragment.

Method 3. Use the system control textswitcher to implement

Layout file

Background file: warning_ bg.xml

code:

Cut in Animation: slide_ in_ bottom.xml

Cut out animation: slide_ out_ top.xml

Note: this method works normally in both activity and fragment. It can solve the problems of vertical scrolling of Android text and overlapping of vertical walking lights in fragment.

summary

The above is a summary of the implementation methods of Android to realize the effect of vertical text scrolling and vertical riding lights introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>