0

I have used MediaSessionCompat for generating media controls in notification by following link

https://android-developers.googleblog.com/2020/08/playing-nicely-with-media-controls.html

Here the issue is i need to make title text to be bold with custom fonts.

i have tried using Html.fromHtml() but this gives heavy bold text in title which i dont want

This is what i want

Spotify media control

What i am getting here is

My output

I want title "No Excuses" to same like spotify's "Lose somebody"

1 Answers1

0

Usually it's better use InboxStyle than HTML parts.

Spannable sb = new SpannableString("Bold text"); sb.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, 3, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

Notification notification = new Notification.Builder() .setContentTitle("5 New mails from " + sender.toString()) .setContentText(subject) .setSmallIcon(R.drawable.new_mail) .setLargeIcon(aBitmap) .setStyle(new Notification.InboxStyle() .addLine(str1) .addLine(sb); .setContentTitle("") .setSummaryText("+3 more")) .build();