如何在通知区域中使用默认填充?

时间:2018-11-19 16:14:05

标签: android android-notification-bar

手机通知区域中显示的通知的顶部和左侧填充都相同,如下图所示。

如何在应用程序的通知中使用这些默认填充,或者从哪里获取官方填充值?

enter image description here

以下是显示通知的代码:

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

0 个答案:

没有答案