Reputation: 813
I am working on the notification. I would set the notification icon using the code below but fail to set the background color of the icon (the rounded purple as highlighted). Great if anyone would share the method.
notificationBuilder.setContentTitle(title);
notificationBuilder.setContentText(summaryText);
notificationBuilder.setSmallIcon(R.drawable.icon);
notificationBuilder.setContentIntent(clickIntent);
notificationBuilder.setDeleteIntent(deleteIntent);
[Follow-up] Yum...I have tried the method as suggested in the post BUT... the background color of the icon is still "white"... I would not set the color...
Upvotes: 1
Views: 648
Reputation: 455
You can probably create drawable to set icon background and set that as icon
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:right="@dimen/margin_10dp" android:left="@dimen/margin_10dp" android:top="@dimen/margin_10dp" android:bottom="@dimen/margin_10dp">
<shape android:shape="rectangle">
<solid android:color="@color/purple"/>
<padding android:bottom="@dimen/margin_10dp" android:right="@dimen/margin_10dp" android:left="@dimen/margin_10dp" android:top="@dimen/margin_10dp"/>
</shape>
</item>
<item android:drawable="@mipmap/logo" >
</item>
</layer-list>
Upvotes: 2
Reputation: 76
I guess that is not recommended do that way, consider provide an icon with the color that you wish
Upvotes: 0