清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
Notification不同版本的使用
//RemoteViews是Notification的内部布局 RemoteViews rv = new RemoteViews(getPackdgeName(),R.layout.rv); rv.setTextViewText = "正在下载"; rv.setImageResource(R.id.img,R.drawable.img);//设置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跳转 NotificationManager nm = (NotificationManager)getSystemService(NOTIFIACTION_SERVICE); //自定义显示状态时 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必须设置否则RemoteViews不起作用 notification.contentIntent = rv; //自定义显示的状态 nm.noti(notificationId,noti);