Using BadgeView to achieve digital reminder effect

BadgeView is a third-party open source library,
github address: https://github.com/stefanjauker/BadgeView
The following is a screenshot of the source code after running, it can be said that all kinds of effects are available. I
took a look at the Demo, in fact, the usage is really awesome, really good easy to use
BadgeView backgroundDrawableBadge = new BadgeView(context);//Get a BadgeView
backgroundDefaultBadge.setBadgeCount(4);//Set the number displayed by BadgeView
backgroundDefaultBadge.setTargetView(view);//Displayed in the upper right corner of a control, the default upper right corner
backgroundShapeBadge.setBackgroundColor(Color.parseColor("#9b2eef"));//custom background color
backgroundDrawableBadge.setBackgroundResource(R.drawable.badge_blue);//Custom background
backgroundShapeBadge.setBackground(12, Color.parseColor("#9b2eef"));//Customize the angle and color, the first parameter is radius
backgroundDrawableBadge.setBadgeGravity(Gravity.LEFT | Gravity.BOTTOM);//Set the display position of BadgeView, don't set this, the default upper right corner
backgroundDrawableBadge.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.ITALIC));//Customize the font of numbers in BadgeView
backgroundDrawableBadge.setShadowLayer(2, -1, -1, Color.GREEN);//Set the font shadow effect
 visibilityBadgeView.setVisibility(visibilityBadgeView.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);//控制BadgeView或隐藏

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326836907&siteId=291194637