Reputation:
My app displays custom notifications with RemoteViews and I want them to look like the device theme. If the user has set his device to night mode, the background should be dark and if the user has set his device to day mode, the background should be white. It should use the default color of the device so it looks like the other notifications and just setting the background to #000000 would leave a white border around the notification anyway.
I use ?android:attr/textColorPrimary
and ?android:attr/textColorSecondary
for the text color.
I haven't set any background color and this works for all devices I've tested except for Samsung... with Samsung devices it's always a white background. In day and night mode.
Is there a style or attribute I can use for my notification background?
Min API is 19.
Edit: When I use @style/TextAppearance.Compat.Notification.Title
and @style/TextAppearance.Compat.Notification
for the text, the notification is readable (instead of white text on white background) but I'd like to have the right background color.
Edit2: I got my hands on a Samsung device. It looks like even Youtube wasn't able to fix this. Some of the notifications are dark though so there must be a solution.
Upvotes: 3
Views: 562
Reputation: 818
If you have access to a physical device then just hook it up to Android Studio and use the Layout Inspector and you can find the color being used when it is in light and dark mode. Unfortunately it will only show you the color value, not the attribute, but I think you can only get the attribute with access to Samsung's source code.
Upvotes: 0