Textview is so simple to realize the running lamp effect!

1、 Method

Here we use two methods to achieve the effect of the running lantern, although it is essentially one

The essence is:

1. Textview calls up the running light effect

2. Textview get focus

First:

1. Textview calls up the running light effect

android:ellipsize="marquee"

2. Textview get focus

android:focusable="true" android:focusableInTouchMode="true"

explain:

This method will stop the running lantern effect if other controls on the interface get the focus

Second:

1. Textview calls up the running light effect

android:ellipsize="marquee"

2. Textview get focus

Our textview uses fry. Mytextview

explain:

Even if other programs get the focus, the marquee effect will not stop.

2、 Code example

design sketch

3、 Code

fry.MyTextView

/textViewDemo1/res/layout/activity04.xml

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.

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
分享
二维码
< <上一篇
下一篇>>