国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

第三方開源庫:給View添加數字:ShortcutBadger + BadgeView

2019-11-09 15:16:59
字體:
來源:轉載
供稿:網友

ShortcutBadger

給app的快捷圖標添加數字 github:https://github.com/leolin310148/ShortcutBadger 在聯想手機上未成功!

效果圖

這里寫圖片描述

gradle

repositories { mavenCentral()}dependencies { compile "me.leolin:ShortcutBadger:1.1.13@aar"}

* Add the codes below:*

int badgeCount = 1;ShortcutBadger.applyCount(context, badgeCount); //for 1.1.4+ShortcutBadger.with(getapplicationContext()).count(badgeCount); //for 1.1.3

If you want to remove the badge

ShortcutBadger.removeCount(context); //for 1.1.4+ShortcutBadger.with(getApplicationContext()).remove(); //for 1.1.3orShortcutBadger.applyCount(context, 0); //for 1.1.4+ShortcutBadger.with(getApplicationContext()).count(0); //for 1.1.3

BadgeView

給應用內的圖標添加數字,不包含app的快捷圖標

效果圖

這里寫圖片描述

Gradle

compile 'q.rorbin:badgeview:1.0.0'

代碼

添加數字

new QBadgeView(context).bindTarget(textview).setBadgeNumber(5);

可以是給Bottombar的個tab添加數字

View tab1 = bottomBar.findViewById(R.id.tab1);new QBadgeView(this).bindTarget(tab1).setBadgeNumber(5);

這里寫圖片描述 取消數字:

qBadgeView.bindTarget(tv).hide(true);

方法說明

code 說明
setBadgeNumber 設置數值
setBadgeNumberSize 設置數值大小
setBadgeNumberColor 設置數值顏色
setExactMode 設置是否顯示精確模式數值
setBadgeGravity 設置Badge相對于TargetView的位置
setGravityOffset 設置外邊距
setBadgePadding 設置內邊距
setBadgeBackgroundColor 設置背景色
setShowShadow 設置是否顯示陰影
setOnDragStateChangedListener 打開拖拽消除模式并設置監聽
hide 隱藏Badge

源碼

https://git.oschina.net/libraryDemo/BadgeView02


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 贵州省| 普洱| 交口县| 卢龙县| 阳信县| 稷山县| 武山县| 都江堰市| 新蔡县| 闻喜县| 黄平县| 芷江| 三明市| 剑河县| 望谟县| 南宁市| 利辛县| 旬阳县| 翼城县| 安阳市| 湖口县| 陈巴尔虎旗| 楚雄市| 惠安县| 岗巴县| 来宾市| 东城区| 兴山县| 湄潭县| 奈曼旗| 义马市| 贺州市| 云阳县| 南岸区| 彭泽县| 余庆县| 积石山| 永城市| 炎陵县| 平利县| 冷水江市|