2016-06-28 17 views
-1

透明な背景を持つカラフルなイメージを通知アイコンとして使用しようとしています。これは古いアンドロイドバージョンでうまく動作しますが、私がMarshmallow(6.0)でテストしたとき、それは白くなります。私はgoogleで解決策を見つけようとしましたが、成功はしませんでした。ここに私のコードです:マシュマロで通知アイコンが白くなる

NotificationManager notificationManager = (NotificationManager) 
context.getSystemService(Context.NOTIFICATION_SERVICE); 
Notification notification = new Notification(icon, message, when); 
String title = context.getString(R.string.app_name); 
Intent notificationIntent = new Intent(context,Activity_Notification.class); 
notificationIntent.putExtra("MSG", message); 
if (notificationIntent != null){ 
int number = createRandomInteger(); 
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | 
Intent.FLAG_ACTIVITY_SINGLE_TOP); 
PendingIntent intent; 
intent = PendingIntent.getActivity(context, number, 
notificationIntent, Intent.FLAG_ACTIVITY_CLEAR_TOP | 
Intent.FLAG_ACTIVITY_NEW_TASK); 
notification.setLatestEventInfo(context, title, message, intent); 
notification.flags |= Notification.FLAG_AUTO_CANCEL; 
notification.defaults |= Notification.DEFAULT_SOUND; 
notification.defaults |= Notification.DEFAULT_VIBRATE; 
notificationManager.notify(number, notification); 
} 

私はこの問題を取り除くために手伝ってください。

+0

白または透明にすることができますhttp://stackoverflow.com/questions/33913952/android-notification-is-not-showing-colour-icon- in-marshmallow –

+0

なぜ私が-veを得たかのような提案。私は将来世話をするでしょう。 – Harry

答えて

0

Android 5.0 behavior changes 1として:

システムは、アクションアイコンおよびメイン通知アイコンにすべての非アルファチャンネルを無視します。これらのアイコンはアルファのみであると仮定してください。通知アイコンは白で表示され、アクションアイコンは濃いグレーで表示されます。

通知で表示される背景色を変更することができますが、小さなアイコンは常にアルファのみ、つまりシステムによって単一の色に着色されます。

1

チェックこのlink、ロリポップ通知アイコンの上にのみ、このポストをチェックしてください

関連する問題