Android - 通知图标非常小

Android - Notification Icons Very Small

我在 Android 应用程序中使用推送通知。我正在使用 Android Asset Studio 来生成我的通知图像。

不过,图片很小,我想填满通知区域space。请看下图:

您可以找到我在我的项目中使用的通知图片 here。 (由 Android Asset Studio 生成)

显示通知的代码here

问题是你只使用 setSmallIcon() 。如果不设置setLargeIcon().

,该图标将显示在状态栏和通知图标中

Set the small icon resource, which will be used to represent the notification in the status bar. The platform template for the expanded view will draw this icon in the left, unless a large icon has also been specified, in which case the small icon will be moved to the right-hand side.

设置大图标。使用 NotificationCompat.Builder 而不是示例 Notification.Builder

Bitmap icon = BitmapFactory.decodeResource(getResources(),R.drawable.app_logo);
Notification noti = new Notification.Builder(mContext)
     .setContentTitle("Title")
     .setContentText(subject)
     .setSmallIcon(R.drawable.small_icon)
     .setLargeIcon(icon )
     .build();