No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
gradle/wrapper
images
library
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

BadgeDrawable

Download

对布局零入侵的高效小红点实现方案。

截图

使用说明

添加依赖

    implementation 'com.githang:badge-drawable:0.2'

代码调用

    // 使用原图标 icon 和小红点 badge 创建BadgeDrawable。 badge 可以从xml中定义,也可以是其他自定义的 Drawable 对象。
    val badgeDrawable = BadgeDrawable(icon, badge)
    // 设置 badgeDrawable
    toggle_badge.setCompoundDrawablesWithIntrinsicBounds(badgeDrawable, null, null, null)
    toggle_badge.setOnClickListener {
        // 显示或隐藏小红点
        badgeDrawable.showBadge = !badgeDrawable.showBadge
    }