1

NotificationBuilderでアンドロイドの通知を作成しましたが、私は.setColor()を設定しましたが、色を無視して小さなアイコンの背景色を黒に設定します。ターゲットSDKは23、最小SDKは19です。また、デバッグに使用している携帯電話には、Android Marshmallowがあります。ご協力いただきありがとうございます。それを解決Androidの通知小さなアイコンの背景は常に黒です

.setContentTitle(msgTitle) 
     .setSmallIcon(R.mipmap.notification_icon) 
     .setColor(R.color.ColorPrime) // ColorPrime is red. 
     .setLargeIcon(msgIcon) 
     .setTicker(msgBody) 
      .setStyle(new NotificationCompat.BigTextStyle() 
        .bigText(msgBody).setBigContentTitle(msgTitle)) 
     .setContentText(msgBody) 
     .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) 
     .setPriority(Notification.PRIORITY_HIGH); 

Preview

答えて

5

。 .setColor(getResources()。getColor(R.color.ColorPrime))を使用した.setColor(R.color.ColorPrime)の代わりに、完全に機能します。

関連する問題