Android textview realizes the running lamp effect
This example shares the specific code of the running lantern effect of Android textview for your reference. The specific contents are as follows
1、 Key points
Set four properties
android:singleLine="true" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true"
Use directly in XML
Note: the singleline attribute cannot be replaced with maxllines
2、 Complex layout
In a complex layout, the running lantern effect may not be achieved. For example, in the following layout, only the first textview will have a running lantern effect
At this time, you need to customize the view to achieve the running light effect
Customize the marqueetextview extensions textview, override the isfocused() method, and return true
Use in layout
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.