Android 实现类似微信客户端朋友圈更新提示的小红点&栏目订阅

时间:2023-03-08 16:53:44

用到的类:

com.jauker.widget.BadgeView

实现代码:

 BadgeView imageBadge = new BadgeView(getContext());
imageBadge.setTargetView(mHolder.image);
imageBadge.setText("");
imageBadge.setHeight();
imageBadge.setWidth();
imageBadge.setBackground(, getContext().getResources().getColor(R.color.badge_red));//#F24541

栏目订阅

                 BadgeView badgeView = new BadgeView(convertView.getContext());
badgeView.setText("");
badgeView.setBadgeMargin();
badgeView.setBackgroundDrawable(parent.getContext().getResources().getDrawable(R.drawable.icon_delete));
badgeView.setTargetView(vh.layout);