With Pushwoosh Inbox UI you can set a custom font for the inbox title, date and push notification text.
Available methods on PushwooshInboxStyle:
An example of Inbox UI with a notification in the inbox:
Step-by-step guide to set a custom font in an Android application:
- Add your font file to
app/src/main/res/font.
- Create
app/src/main/res/font/custom_font.xml:<?xml version="1.0" encoding="utf-8"?> <font-family xmlns:android="http://schemas.android.com/apk/res/android"> <font android:font="@font/custom_font" android:fontStyle="normal" android:fontWeight="400" /> </font-family>
- Define text styles in
app/src/main/res/values/pushwoosh_styles.xml:<?xml version="1.0" encoding="utf-8"?> <resources> <style name="TextAppearance.Inbox.InboxTitle" parent="TextAppearance.AppCompat.Subhead"> <item name="android:fontFamily">@font/custom_font</item> </style> <style name="TextAppearance.Inbox.InboxDate" parent="TextAppearance.AppCompat.Caption"> <item name="android:fontFamily">@font/custom_font</item> </style> <style name="TextAppearance.Inbox.InboxDescription" parent="TextAppearance.AppCompat.Body1"> <item name="android:fontFamily">@font/custom_font</item> </style> </resources>
- Apply the font in your Activity:
// Load the custom font for inbox messages val customFont = ResourcesCompat.getFont(this, R.font.custom_font) // Set the custom font for title, date and description of a message in the inbox if (customFont != null) { PushwooshInboxStyle.setTitleFont(customFont) PushwooshInboxStyle.setDateFont(customFont) PushwooshInboxStyle.setDescriptionFont(customFont) }
Comments
0 comments
Please sign in to leave a comment.