设置为通知时,大图片正在裁剪

Gau*_*ora 3 android push-notification remoteview

我想在Android通知栏中显示大图片样式图片.但是我遇到了问题 - >当我使用以下代码在通知栏中设置图像时:

PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
            NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctx)
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle(title)
            .setContentText(message)
            .setOngoing(false)
            .setAutoCancel(true)
            .setStyle(new NotificationCompat.BigPictureStyle()
            .bigPicture(bitmap))
            .setPriority(Notification.PRIORITY_HIGH)
            //.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
            .setContentIntent(resultPendingIntent);
            // mId allows you to update the notification later on.
            mBuilder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI);
            mBuilder.setDefaults(Notification.DEFAULT_VIBRATE);
            NotificationManager mNotificationManager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
            mNotificationManager.notify(0 , mBuilder.build());
Run Code Online (Sandbox Code Playgroud)

它始终从左右角落裁剪.我不想使用远程视图.任何人都可以告诉我可以放在通知栏中的图像的大小和分辨率,不应该被裁剪.

谢谢

Roh*_*ich 13

它被裁剪的原因是因为它不是2:1比例的图像,你提供的大图片应该是2:1的比例,否则它会被裁剪或图像很小它会拉伸.

看看这个https://documentation.onesignal.com/docs/android-customizations#section-big-picture