i want to include line breaks in the long text of notifications. \n
does not work.
notification.setLatestEventInfo(context, title, message+"\r\n"+"test",intent);
what is the code for the line break in the android2.2 notification ?
Thanks
I think you might have to create a custom notification layout with two text views, each for a line.
Here's the official tutorial for notifications, I am not sure how much of it applies to 2.2 though.
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
The following link might be useful too:
Custom notification layouts and text colors
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 can help me out here.How to implement BigPictureStyle notification with multiline summary text in android.I am able to do by reducing text size which I don't want to.Please help me out on this.
Can we combine two types of notification like big picture and big text style?Does any one know about this?
From your requirement i can figured out that you have to create custom layout for notification because basically you can not combine both BigPicture and BitText style so you have to go with the custom view for notification.
you can read this Custom notification for android as well example from this solution
Is it possible to show notifications like in a table with horizontal cell-padding?
I created this example with tabs \t but i want to style the first "column" and because of not knowing the exactly width after that, i think this is not a good option.
Is there a table-like solution to show notification text?
You're left with implementing your own notification layout.
Use a RemoteView and inflate it as described in the API Guide : http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification
I'm trying to create a custom notification layout that looks just like a 3.0 notification, with a couple of extra things sprinkled in. More importantly, I also want to derive a Jelly Bean expanded notification on top of that.
I'd like the notification to have the same layout as a stock notification so it fits in nicely, i.e. like this (bottom image):
However, I cannot find any information about the proper dimensions and styles - what size do I need to use for the image on the left? What style for each text? What padding?
Ideally, I'd love to use something like android.R.listPreferredItemHeight for the height of the layout and the dimensions of the image, but I can't find anything that pertains to notifications.
You can use the Notification.Builder class which provides a convenient way to set the various fields of a Notification and generate content views using the platform's notification layout template.
See: http://developer.android.com/reference/android/app/Notification.Builder.html
If you need to be compatible with versions prior to API level 11 then take a look at the NotificationCompat.Builder from the support library.
I want to change default android notification view. Can I make height of Custom Expanded View more than 3 lines of text?
Check this article on how to make custom notifications using your own layout. If this helps you already: good. If not: The RemoteView also offers options to create custom notifications, so it might help you. Alternatively you could create multiple notifications if the number of lines is really limited (which I am not sure of).