Android badgeview Red dot Update info tip

Source: Internet
Author: User
Tags set background


Application market Many applications will see some of the effects of the number of red dots, such as QQ, as well as some tips to update the app, in order to achieve better application of the hint function, this article will introduce an open source control to implement red dot update information hint effect.

First, badgeview commonly used methods introduced:

1.setBadgeCount (int): Set reminder number

2.setBadgeGravity (Gravity): Set Location layout

3.setTargetView (View): Set prompt Control object

4.setTypeface (): Set Display font

5.setShadowLayer (): Set Font Shadow

6.setBackgroundColor (): Set background color

7.setBackgroundResource (): Set background picture

Second, the construction of third-party tools source code

Compile files (' Libs/badgeview.jar ')

Second, the code to achieve four kinds of effects

1. Effect One:

Badgeview badgeView1 = new Com.jauker.widget.BadgeView (this); Badgeview1.settargetview (MTIPTEXT1); Badgeview1.setbadgecount (3);

2. Effect Two

Badgeview badgeView2 = new Badgeview (this); Badgeview2.settargetview (MTIPTEXT2); Badgeview2.setbackground (12, Color.parsecolor ("#9b2eef")); Badgeview2.settext ("hint");

3. Effect three

Badgeview badgeView3 = new Badgeview (this); Badgeview3.settargetview (MTIPTEXT3); Badgeview3.setbadgegravity ( Gravity.top | Gravity.left); Badgeview3.settypeface (Typeface.create (Typeface.sans_serif,        typeface.italic)); Badgeview3.setshadowlayer (2,-1,-1, Color.green); Badgeview3.setbadgecount (2);

4. Effect Four

Mtiptext4.setonclicklistener (New View.onclicklistener () {    @Override public    void OnClick (view view) {        TextView TextView = (TextView) Layoutinflater                . from (Mainactivity.this). Inflate (r.layout.activity_main2, NULL). Findviewbyid (R.id.id_activity2_textview);        Textview.settext ("the");        StartActivity (New Intent (Mainactivity.this, Mainactivity2.class));}    );


Three






Four: source code download

Address: http://download.csdn.net/detail/u012721519/9743227



Good luck!

Write by Jimmy.li










Android badgeview Red dot Update info tip

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.