手机通知区域中显示的通知的顶部和左侧填充都相同,如下图所示。
如何在应用程序的通知中使用这些默认填充,或者从哪里获取官方填充值?
以下是显示通知的代码:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, channelId);
mBuilder.setSmallIcon(getNotificationIcon(mBuilder));
String appName = getResources().getString(R.string.app_name);
mBuilder.setContentTitle(appName);
mBuilder.setContentInfo("TEST");
mBuilder.setContentText(alertMsg);
Notification notification = mBuilder.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
mNotificationManager.notify(notificationId, notification);