Search code examples
androidandroid-4.2-jelly-bean

Title of each line should look different in android 4.1 inbox style notification?


Android (4.1) Inbox Style Notification

I'm wondering how gmail app is able to set the title of each line in jellybean inbox style notification differently e.g here "(Google+), Google Play, Stack Exchange" etc have brighter color text comparing to their individual details. Any clue ?

http://developer.android.com/guide/topics/ui/notifiers/notifications.html#BigNotify


Solution

  • addLine() on InboxStyle takes a CharSequence. Hence, you can use a SpannedString instead of a regular String, where the SpannedString contains inline markup rules. A convenient (if a bit slow) way to accomplish this is to use Html.fromHtml() to convert simple HTML markup into a suitable CharSequence.