//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);