Android achieves LED luminous word effect

Hello, everyone, this blog is to teach you a small case similar to the LED alarm clock display. The UI is beautiful. At the end of the article, we will provide the download related resource address for you to download. First, let's take a look at the operation effect of this case.

During normal operation in the mobile phone, the effect is very smooth. On GIF, the speed may be adjusted faster after transcoding, so it looks faster. These are small things. Next, let's see how the source code is implemented.

1. The code is very simple. It mainly uses several attributes of the XML layout file, and can easily achieve the effect we see by setting our specific font. First, we create a class ledtextview to inherit from textview.

Here we set our specific font style digital-7.ttf.

2. Let's see how the layout file is written

As you can see, we mainly set the following properties on the textview control in the upper layer

And the specified color is set, so that the effect of LED luminous words can be realized.

3. Let's take a look at how mainactivity is implemented. The code is very simple. It mainly obtains the current time and intercepts the textview assigned to us by hours, minutes and seconds.

How, is the code simple to implement? Let's give it a try!

Font resource download address: Android realizes LED luminous word effect

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