Add a reminder above the Android icon (ii) using the Open Source UI class library Viewbadger

Source: Internet
Author: User
Tags add numbers

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The previous article described using canvas to draw the corresponding final bitmap. In practice, in addition to adding numbers to the icons, it is possible to add icons such as red squares as reminders of new features.

So is there any way to easily add a reminder icon or number to the icons?

Yes, or with the help of the Open source project Viewbadger, this is the address on GitHub:

Https://github.com/jgilfelt/android-viewbadger

Let's look at the following:

The usage is simple:

The first is to add numbers:

[Java]View Plaincopy print?
    1. Badgeview Badgeview = new Badgeview (mainactivity.   this, IV1);
    2. Badgeview.settext ("5");
    3. Badgeview.show ();

Then add the text:

[Java]View Plaincopy print?
    1. Badgeview Badgeview = new Badgeview (mainactivity.   this, iv2);
    2. Badgeview.settext ("new Message");
    3. Badgeview.settextsize (8.5f);
    4. Badgeview.settextcolor (Color.dkgray);
    5. Badgeview.show ();
Finally, add a specific icon, just the ID of the drawable

[Java]View Plaincopy print?
    1. Badgeview badgeView2 = new Badgeview (mainactivity.   this, iv3);
    2. Badgeview2.setbackgroundresource (R.drawable.noread);
    3. Badgeview2.show ();
Hide/Remove reminder icons or numbers (with normal view hidden methods);

[Java]View Plaincopy print?
    1. Badgeview.setvisibility (View.gone);
How about, as long as the View object can add a reminder icon or number, is not very convenient,. Just use it for a second.

Source:

http://download.csdn.net/detail/t12x3456/5983875

If reproduced, please declare the source: The Sands of Time: http://blog.csdn.net/t12x3456

Add a reminder above the Android icon (ii) using the Open Source UI class library Viewbadger

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.