相关疑难解决方法(0)

在Android 5 Lollipop中,通知栏图标变为白色

我有一个显示自定义通知的应用.问题是,在Android 5中运行时,通知栏中的小图标显示为白色.我怎样才能解决这个问题?

android android-notifications android-5.0-lollipop

204
推荐指数
9
解决办法
19万
查看次数

改变在棒棒糖的通知象背景

我正在通过通知设计模式,并没有找到任何谈论通知图标背景.您可能已经注意到,自定义通知只有浅灰色背景.但是环聊等应用或简单的USB调试通知都会为其通知图标背景提供自定义颜色.

有没有可能将那种灰色变成其他东西?(以编程方式显示特定圆圈的颜色)

见图

android android-notifications android-5.0-lollipop

77
推荐指数
2
解决办法
5万
查看次数

Firebase通知始终显示空白图标

我是FCM的新手.我无法让FCM使用我的应用程序图标作为通知图标,图标始终为白色空白图标.

我向mipmap文件夹导入了一个图标但似乎没有任何改变.正如一些家伙所说,这是因为在这个问题中的棒棒糖通知

但问题是,FCM通知会自动弹出,我无法让Notification构建器覆盖图标.我该怎么改变它?

android android-notifications firebase firebase-cloud-messaging firebase-notifications

14
推荐指数
3
解决办法
1万
查看次数

灰色方块作为使用Firebase通知的通知图标

我正在尝试将Firebase Cloud Messaging集成到我的Android应用程序中.但是,当应用在后台或已关闭时,Firebase通知会显示灰色方块图标,而不是应用程序的启动器图标.

如何在不实施Firebase服务器API和发送数据消息的情况下将通知图标设为我的应用程序徽标?

android firebase-cloud-messaging

13
推荐指数
3
解决办法
2万
查看次数

大图标位图在通知中显示为白色方块?

我遇到了这个问题,我Bitmap从我在通知中使用的URL 生成了一个.然而,在我的手机上,Bitmap显示像一个小的白色方块.我调查了一下,发现很多帖子就像这样谈论它:图标没有显示在通知中:显示的是白色方块

我知道我Small Icon的通知确实是透明的.但是,对于Large Icon,我意识到它Large Icon不能透明,因为它实际上是Bitmap我从URL生成的.我怎样才能解决这个问题并确保图像正确呈现而不是将其Large Icon显示为白色方块?这是我的尝试:

NotificationService.java:

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
            .setContentTitle(getString(R.string.app_name))
            .setContentText(remoteMessage.getNotification().getBody())
            .setTicker(remoteMessage.getFrom() + " has responded!")
            .setLargeIcon(AndroidUtils.getBitmapFromURL(remoteMessage.getNotification().getIcon()))
            .setAutoCancel(true)
            .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(remoteMessage.getNotification().getBody()))
            .setSmallIcon(R.drawable.ic_tabs_notification_transparent);
Run Code Online (Sandbox Code Playgroud)

AndroidUtils.java:

public static Bitmap getBitmapFromURL(String userId) {
        try {
            URL imgUrl = new URL("https://graph.facebook.com/" + userId + "/picture?type=large");
            InputStream in = (InputStream) imgUrl.getContent();
            Bitmap  bitmap = BitmapFactory.decodeStream(in);
            Bitmap output;
            Rect srcRect;
            if (bitmap.getWidth() > bitmap.getHeight()) {
                output = Bitmap.createBitmap(bitmap.getHeight(), …
Run Code Online (Sandbox Code Playgroud)

java icons android bitmap android-notifications

13
推荐指数
1
解决办法
1142
查看次数

android 7.0通知图标出现白色方块

我使用下面的代码片段在我的Android应用程序中生成通知.

private void sendNotification(String contentText, String message) {

    Intent resultIntent = new Intent(this, MainActivity.class);
    resultIntent.putExtra("clear","clear");
    resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | 
     Intent.FLAG_ACTIVITY_CLEAR_TASK);

   PendingIntent piResult = PendingIntent.getActivity(this, 0, resultIntent,0);

    NotificationCompat.Builder builder=new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.icon)
            .setColor(ContextCompat.getColor(getApplicationContext(),R.color.red))
            .setContentTitle("title")
            .setContentText(message)
            .setAutoCancel(true)
            .setLargeIcon(BitmapFactory.decodeResource(getResources() 
            ,R.drawable.notification))
            .setContentIntent(piResult);

    NotificationCompat.InboxStyle notification = new NotificationCompat.InboxStyle(builder);

    int i;
    for(i=0; i<messageList.size();i++){
        notification.addLine(messageList.get(i));
    }
    notification.setBigContentTitle("title");
    notification.setSummaryText(contentText);

    NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify(NOTIFICATION_ID,notification.build());
}
Run Code Online (Sandbox Code Playgroud)

它适用于android 5和6但是对于android nougat它不起作用

android android-notifications android-7.0-nougat

6
推荐指数
1
解决办法
1万
查看次数

Android通知图标如何支持多种颜色(两种以上颜色)?

  1. 我正在开发Android应用程序(API 级别 >23)。我必须支持Notification
  2. 而且我的通知图标支持两种以上的颜色。
  3. 如果我使用该图标,则图标在通知面板中显示为灰色。
  4. 所以我创建了背景透明且完全白色的图标并动态设置颜色。

  5. 但我只能设置一种颜色(setColor())。

所以我的问题是:-

Android通知图标如何支持多种颜色(两种以上颜色或颜色渐变)?注意:- 我参考了Android 推送通知:通知中未显示图标,而是显示白色方块

感谢您提前的支持。

android apple-push-notifications android-notification-bar material-design androiddesignsupport

6
推荐指数
1
解决办法
3952
查看次数

通知图标未显示在 flutter andriod 应用程序 local_notification_flutter 中

我是新手,所以如果我的问题很简单,请不要杀我。

通知图标不是这样显示的

在此处输入图片说明

我把这条路

\android\app\src\main\res\drawable

这是我的图标代码:

final settingsAndroid = AndroidInitializationSettings('app_icon'); final settingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: (id, title, body, payload) => onSelectNotification(payload)); final settingsIOSgeneral = IOSInitializationSettings(onDidReceiveLocalNotification: (id, title, body, payload) => onSelectNotificationgeneral(payload)); notifications.initialize(InitializationSettings(settingsAndroid, settingsIOS), onSelectNotification: onSelectNotification);

任何人都可以帮助我如何在通知中预览我的图标?

notifications flutter

5
推荐指数
2
解决办法
6066
查看次数

如何更改从 Firebase Cloud Messaging Flutter 发送的通知图标

因此,我正在学习使用 Flutter 使用 Firebase Cloud Messaging 推送通知。

我已成功在 Android 中显示从 Firebase 控制台发送的通知,但问题是显示的图标与我的应用程序图标不匹配,如下所示: 在此输入图像描述

如何更改图标?谢谢

更新
所以实际上我认为这是我提供的资产形式的问题。因为如果通知位置进来并且你没有打开通知托盘,那么图标就是它应该的颜色。

但是当你打开通知托盘时,由于某种原因,图标变成灰色......

因为我看到好几个这样的申请,其中一个甚至是银行申请

push-notification firebase flutter firebase-cloud-messaging

1
推荐指数
1
解决办法
1830
查看次数