Example of simple bullet screen effect realized by Android programming [download demo source code attached]

This paper describes the simple barrage effect realized by Android programming. Share with you for your reference, as follows:

First, the rendering is shown, which is similar to the page where 360 detects harassing calls:

The layout is very simple, with a relativelayout above and a button below

Function:

(1) After the barrage is generated, it will automatically scroll from the right to the left (translate animation). After the barrage disappears, it will be removed immediately. (2) The bullet screen position appears randomly and does not repeat (to prevent text overlap). (3) The font size changes randomly within a certain range, and the font color can also be set. (4) Customize the interpolator that decelerates first and then accelerates. The barrage accelerates in, decelerates and stops, and then accelerates out.

1. Activity Code:

2. Pan animation generation tool:

Screenutils is a tool class used to obtain the screen width and height, and the rotation between DP and PX.

3. The custom interpolator actually has only one line of code

4. Tamubean is an entity class

Click here to download the complete example code.

More readers interested in Android related content can view the special topics of this site: summary of Android view skills, summary of Android development animation skills, summary of activity operation skills of Android programming, summary of Android layout skills, introduction and advanced tutorial of Android development, summary of Android resource operation skills, and Android control usage summary

I hope this article will help you in Android programming.

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