Android消息提示小红点框架,简单快捷。

一,老规矩上图
在这里插入图片描述

二,功能描述

  1. 支持颜色(背景颜色,字体颜色),修改
  2. 可以选择是否越界 越界默认圆心位置
  3. 一位数:自动单个圆。二位数的自动加长。三位数自动99+,没有数字默认小圆点
  4. 移除小点
 dot1.remove(tv1)

使用方式:

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
Step 2. Add the dependency

dependencies {
        implementation 'com.github.o199666:CwjDotView:1.1'
}

代码:

var dot1 = DotView(this)
        dot1.setTargetView(tv1)

        var dot2 = DotView(
            this,//当前
            12,//数字
            R.color.teal_200,//背景色
            R.color.white,//字体颜色
            20f,//不带数字的圆点的大小
            50f,//带有数字的圆点的 大小
            35f,
            true//是否越界 越界默认圆心为准
        )
        dot2.setTargetView(tv2)


        var dot3 = DotView(
            this,//当前
            999//数字
        )
        dot3.setTargetView(img)


        var dot4 = DotView(
            context = this,//当前
            number = 88,//数字 如果不写/0 就是小圆点。
            bgcolor = R.color.red,//背景色
            textColor = R.color.white,//字体颜色
            dotRadioSize = 20f,//不带数字的圆点的大小
            numberDotSize = 50f,//带有数字的圆点的 大小
            numberTextSize = 35f,//文字大小。
            isOverstep = false//是否越界 越界默认圆心为准
        )
        dot4.setTargetView(img1)
        var dot5 = DotView(
            context = this,//当前
            bgcolor = R.color.purple_200,
            dotRadioSize = 30f,
            isOverstep = false//是否越界 越界默认圆心为准
        )
        dot5.setTargetView(ll)
        var dot6 = DotView(this)
        dot6.setTargetView(ll_btn)
        //清除
        btn.setOnClickListener {
            dot1.remove(tv1)
            dot2.remove(tv2)
            dot3.remove(img)
            dot4.remove(img1)
            dot5.remove(ll)
            dot6.remove(ll_btn)

        }

        btn1.setOnClickListener {
            dot6.setTargetView(ll_btn)
            dot5.setTargetView(ll)
            dot4.setTargetView(img1)
            dot3.setTargetView(img)
            dot2.setTargetView(tv2)
            dot1.setTargetView(tv1)


        }

    }

地址:github
欢迎star,有啥需求留言,进行改进

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值