国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

MIUI6&7桌面角標(biāo)開源代碼簡(jiǎn)介

2018-02-25 14:23 更新

MIUI6&7桌面角標(biāo)開源代碼簡(jiǎn)介

MIUI6&7上重新設(shè)計(jì)了桌面app圖標(biāo)的角標(biāo)顯示,基本規(guī)則如下:

一、基本介紹

1、默認(rèn)的情況

當(dāng)app 向通知欄發(fā)送了一條通知 (通知不帶進(jìn)度條并且用戶可以刪除的),那么桌面app icon角標(biāo)就會(huì)顯示1.此時(shí)app顯示的角標(biāo)數(shù)是和通知欄里app發(fā)送的通知數(shù)對(duì)應(yīng)的,即向通知欄發(fā)送了多少通知就會(huì)顯示多少角標(biāo)。

2、通知可以定義角標(biāo)數(shù)

例如 有5封未讀郵件,通知欄里只會(huì)顯示一條通知,但是想讓角標(biāo)顯示5. 可以在發(fā)通知時(shí)加個(gè)標(biāo)示。

二、實(shí)現(xiàn)代碼

第三方app需要用反射來(lái)調(diào)用,參考代碼:

NotificationManager mNotificationManager = (NotificationManager) this

.getSystemService(Context.NOTIFICATION_SERVICE);

Notification.Builder builder = new Notification.Builder(this)

.setContentTitle(“title”).setContentText(“text”).setSmallIcon(R.drawable.icon);

Notification notification = builder.build();

try {

Field field = notification.getClass().getDeclaredField(“extraNotification”);

Object extraNotification = field.get(notification);

Method method = extraNotification.getClass().getDeclaredMethod(“setMessageCount”, int.class);

method.invoke(extraNotification, mCount);

} catch (Exception e) {

e.printStackTrace();

}

mNotificationManager.notify(0,notification);

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)