I was wondering...
I've been able to create a styled notification on my android-wearable-device (using spannable-strings) while implementing it on a wearable-based app.
(I used the SpannableStringBuilder class for that purpose).
Now, Whenever you create styled notifications on a phone-based app (using SpannableStringBuilder), they will show up on the wearable-device, but without the special styling...
Is there any way to achieve styled notifications on the wearable device with only a phone-based app?
Thanks.
Most styling effects applied to notifications created on an handheld device will show up on both wearable and handheld devices.
Styling effects that will show up on WEARABLE and HANDHELD devices :
Color (ForegroundColorSpan)
Underline (UnderlineSpan)
Text style (StyleSpan) including : BOLD, ITALIC, BOLD_ITALIC
Font family (TypeFaceSpan)
Subscript (SubscriptSpan) and superscript (SuperscriptSpan)
Styling effects that will show up on HANDHELD devices ONLY :
Text size (RelativeSizeSpan)
Strikethrough (StrikethroughSpan)
The styling should show up on both. I have done it using the SpannableStringBuilder class and NotificationCompat.
Please refer to our sample under samples/android-20-wearable/Notifications. Take a look inside NotificationPresets in the Application module. It contains a private static class StylizedTextNotificationPreset and the method buildNotifications contains the code for stylised notifications.
One thing to note is color. In Holo, the default background is black whereas on Wear, the notification background is white. I find that colour tends to work well against one and not the other or vice versa so I would recommend using colour sparingly and maybe only stick to shades of grey. I hope this helps.
Related
We are using Foreground Service with Notification. A very simple use-case requires us to change the text-colour of the notification's body and title text. After a quick search, I was enlighten with setColor() method of NotificationCompat.Builder.
However, using it only changes the tint colour of the small icon and not the notification title or body text. I also wanted the text 0/7 files have been uploaded and 7 pending to be coloured desirably. This is how it looks currently,
How can I change the text colour of the notification title and body text?
you can't change this, this is system style for Notification, don't have option for setting text color... but you can introduce your own layout for this purpose, but be aware that across different Android distributions there are different default Notification styles (made by manufacturers) and you won't provide one universal style with only-text-color-changed style, which will fit into system styling (same look as other notifications)
does anyone know how to define style like mediastyle for notifications in android. I want to use different background color for notification that appear on devices who has android version 5.0 or above. I want to use same color, but I want to use different height of notification, and I don't want a buttons in notification. Currently I use custom view for notification that has same background color like medaistyle notification, but custom view appears only on devices that has version of android lower then 5.0 . Can anyone help please
Thank you very much
As we known that Android lollipop force set the notification background color to white, so we can set the style of TextView according to different sdk version by putting style.xml in folder values-v21.
So here comes my question, on some third party ROMs, for example, the EMUI developed by Huawei tech co., the background of notification is not white(nearly black), by setting style to
android:TextAppearance.Material.Notification.Title
the color of the text is almost black, as a result, we cannot see the text clearly. I had been searching the internet for almost two days but find nothing helps.
I am trying to get the color of the notification background and set the text color dynamically, but I don't know how to accomplish this.
Need your help, thanks a lot.
Ok, so I just use the official API to set the notification info, that would inflate the default notification layout (status_bar_latest_event_content.xml)instead of my custom layout.
The rom changed the default background and text-color of the status_bar_latest_event_content.xml, but it wouldn't (or can't) change the custom layout.
mBuilder.setLargeIcon(combineBitmap).setContentText(notifyString).setSubText("fff");
remove the android:targetSdkVersion="21" from manifest.xml. it will work! and from this there is no prob at all in your apk it just a trick i apply this and i found colorful icon in notification and all features will remain same which u earlier use
I'm struggling with creating a custom notification whose expanded view is defined by a RemoteView using a bigContentView.
I'd like for this notification to look exactly like a default notification however I'm having issues achieving this across all platforms.
I can pull the font size and color of the title and description using #android:style/TextAppearance.StatusBar.EventContent.Title however I can't seem to find a way to determine what positioning to use for those titles and descriptions (margins, padding).
I also can't seem to determine what icon size or background to use for the icon. For example on some devices, there is a light blue background that appears behind the notification icon, but on Samsungs this doesn't seem to be the case.
I'm creating my own remote view for the status bar(notification center). I want the remote view to have the same background color as the other notifications and I want it to be consistent across devices, e.g. Samsung and stock Android.
The only layout information I managed to find was under \android-sdk\platforms\android-14\data\res\layout\status_bar_latest_event_content.xml
In addition I found icon guidelines however I couldn't find anything related to background color.
I played with Photoshop and found the default color for Stock Android (#111111), however I don't want to hard code it.
When not using any background color the default that I get is grayish (see attachment)
Any suggestions ?