中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

Notification的簡單使用

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用
Notification不同版本的使用
//RemoteViews是Notification的內(nèi)部布局
RemoteViews rv = new RemoteViews(getPackdgeName(),R.layout.rv);
rv.setTextViewText = "正在下載";
rv.setImageResource(R.id.img,R.drawable.img);//設(shè)置Notification的圖片
rv.setProgressBare(R.id.notiProgressbar, 100, 0, false);
Notification notification = new Notification();//過時版本的寫法
notification.tickerText = "開始下載";
notification.icon = R.drawable.ic_laucher; //必須加上此處,否則后面的RemoteViews不起作用
notification.flag = Notification.FLAG_AUTO_CANCEL;  //點擊完后自動清除
PendingIntent pendingIntent = PendingIntent.getAcitivity(this,0,new Intent(this,MainActivity.class),0);
notification.contentView = rv;
notification.contentIntent=pendingIntent;  //點擊Notification跳轉(zhuǎn)
NotificationManager nm = (NotificationManager)getSystemService(NOTIFIACTION_SERVICE);
//自定義顯示狀態(tài)時
noti.setLatestEventInfo(this,contentTitle,contentText,0);
nm.noti(notificationId,noti);
 
//新版本的寫法
Notification notification = new Notification.Builder(this).setContentIntent(pendingIntent).setContentTitle("下載完成").setContentText("微笑通").setSmallIcon(R.drawable.img);//同樣此處icon必須設(shè)置否則RemoteViews不起作用
notification.contentIntent = rv; //自定義顯示的狀態(tài)
nm.noti(notificationId,noti);

標(biāo)簽:

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:Python 驗證碼識別

下一篇:PHP生成 中文驗證碼 漢字圖片驗證碼