Watch 1 Star 1

码云极速下载 / bgabadgeview

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库:
Nothing here. spread retract

Clone or download


Android Arsenal License Download



The demo shows:

  • The latest message number of weibo at the bottom tab
  • The VIP badge located in lower-right Corner of User’s Photo in the weibo user list
  • The new message in the weixin message page
  • The subscribe message in the weixin message page
  • User’s round corner photo made by RoundedBitmapDrawable from v4 package
  • Delete badge by drag and drop

The realization of explosion effect refers to ExplosionField with the modify of only retaining one View,and only refresh the field around of badge



Gradle Dependencies


dependencies {
    implementation 'cn.bingoogolapple:bga-badgeview-api:latestVersion'
    annotationProcessor "cn.bingoogolapple:bga-badgeview-compiler:latestVersion"

Initialize BGABadge

Add BGABadge annotation to any class, such as newly created class BGABadgeInit

        View.class, // ===> cn.bingoogolapple.badgeview.BGABadgeView,If you do not need, please delete this line
        ImageView.class, // ===> cn.bingoogolapple.badgeview.BGABadgeImageView,If you do not need, please delete this line
        TextView.class, // ===> cn.bingoogolapple.badgeview.BGABadgeFloatingTextView,If you do not need, please delete this line
        RadioButton.class, // ===> cn.bingoogolapple.badgeview.BGABadgeRadioButton,If you do not need, please delete this line
        LinearLayout.class, // ===> cn.bingoogolapple.badgeview.BGABadgeLinearLayout,If you do not need, please delete this line
        RelativeLayout.class, // ===> cn.bingoogolapple.badgeview.BGABadgeRelativeLayout,If you do not need, please delete this line
        FloatingActionButton.class, // ===> cn.bingoogolapple.badgeview.BGABadgeFloatingActionButton,If you do not need, please delete this line
public class BGABadgeInit {

Supported badge style for now

Class name usage scenario
BGABadgeRadioButton Bottom navigation of weibo home page
BGABadgeImageView User’s photo of weibo user list
BGABadgeTextView You can alternatively use BGABadgeCheckedTextView
BGABadgeLinearLayout Message number in the right of item in the list
BGABadgeRelativeLayout Message number in the right of item in the list
BGABadgeFrameLayout Message number in the right of item in the list

Interface/api explain

 * show circle badge
void showCirclePointBadge();

 * show text badge
 * @param badgeText
void showTextBadge(String badgeText);

 * hide badge
void hiddenBadge();

 * show image badge
 * @param bitmap
void showDrawableBadge(Bitmap bitmap);

 * set the delegate to delete the badge by drag and drop
 * @param delegate
void setDragDismissDelegage(BGADragDismissDelegate delegate);

 * Whether show the badge or not
 * @return
boolean isShowBadge();

 * Can it be dragged
 * @return
boolean isDraggable();

 * Whether being dragged
 * @return
boolean isDragging();

The customed attribution

The customed attribution Explain Default value
badge_bgColor Badge background Color.RED
badge_textColor Text color of badge Color.WHITE
badge_textSize Text font size of badge 10sp
badge_verticalMargin The distance in pixels from the top edge of badge’s background to the top edge of the host or from the bottom edge of badge’s bottom to the host’s bottom 4dp
badge_horizontalMargin The distance in pixels from the edge of badge’s background to the left or right edge of the host 4dp
badge_padding Badge’s padding 4dp
badge_gravity Badge’s gravity, it’s layout direction For BGABadgeImageView and BGABadgeRadioButton, upper right.For others, the default is the right side of the vertical center
badge_draggable The badge can be drag or not false
badge_isResumeTravel When the badge is dragged out of path, if it can resume the path in case of put back false
badge_borderWidth Border width of badge 0dp
badge_borderColor Border color of badge Color.WHITE
badge_dragExtra Extra distance of trigger drag event 4dp

About me

Personal homepage email QQ for the BGA funs BGA_CODE_CLUB


It takes much time and energy to maintain and improve this project. It BGA helps you, you may want to buy me a coffee :).


Copyright 2015 bingoogolapple

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Comments ( 0 )

You need to Sign in for post a comment

Help Search