我已经建立了一个通知,但是当我设置大图标时,它不适合边界。我会将其设置为按预期显示。
以下是创建通知的代码:
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(image)
.setContentTitle(appName)
.setContentText(message)
.setSound(defaultSoundUri)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setContentIntent(pendingIntent);
答案 0 :(得分:0)
尝试使用自定义布局显示通知:
这可能会对您有所帮助:
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
RemoteViews contentView = new RemoteViews(pkgName, R.layout.custom_notification);
contentView.setImageViewResource(R.id.notification_image, appIcon);
contentView.setTextViewText(R.id.notification_text, message);
notification.contentView = contentView;