Red dot display of Android unread messages

In many apps, you often see small red dots of unread messages, as shown in the following figure:

This function uses a control called badgeview.

The usage of badgeview is very simple. You can directly import the jar file into the package. It is also very simple to use,

Badgeview can be used on any control. However, in the bottom navigation composed of RadioButton, if it is directly used on RadioButton, the click of RadioButton will be invalid.

The solution is to add a layer of layout on RadioButton, and then set the layout to non clickable. I use button here.

The layout is only used to display the number of unread messages.

Layout code:

Download link for package:

http://xiazai.jb51.net/201704/yuanma/badgeview_ jb51.rar

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of 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
分享
二维码
< <上一篇
下一篇>>