我完成了这个任务。
Notification.Builder notificationBuilder = new Notification.Builder(
getApplicationContext());
RemoteViews mContentView = new RemoteViews(
getApplicationContext().getPackageName(),
R.layout.custom_notification);
Uri alertSound = RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
notificationBuilder.setSound(alertSound);
mContentView.setTextViewText(R.id.text, getResources()
.getString(R.string.activation_code)
+ ": "
+ mUUID);
notificationBuilder.setContent(mContentView);
notificationBuilder.setContentTitle(getResources()
.getString(R.string.activation_code));
notificationBuilder
.setSmallIcon(R.drawable.ic_launcher);
notificationBuilder.setAutoCancel(true);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(11151990,
notificationBuilder.getNotification());
非常简单,这个方法一直都很好用,直到我升级了我的Nexus 7为Lollipop操作系统。现在通知栏上的图标显示为白色圆圈。如何解决这个问题? 当我从顶部下拉时,通知里面看起来是正常的。