Custom styling
This reference article covers how to add custom News Feed styling in your Android or FireOS application.
News Feed is being deprecated. Braze recommends that customers who use our News Feed tool move over to our Content Cards messaging channel—it’s more flexible, customizable, and reliable. Check out the migration guide for more.
Braze UI elements come with a default look and feel that matches the Android standard UI guidelines and provides a seamless experience. You can see these default styles in the res/values/style.xml
file in the Braze SDK distribution:
1
2
3
4
5
6
7
8
9
10
11
12
13
<style name="Braze"/>
<!-- Feed -->
<style name="Braze.Feed"/>
<style name="Braze.Feed.List">
<item name="android:background">@android:color/transparent</item>
<item name="android:divider">@android:color/transparent</item>
<item name="android:dividerHeight">16.0dp</item>
<item name="android:paddingLeft">12.5dp</item>
<item name="android:paddingRight">5.0dp</item>
<item name="android:scrollbarStyle">outsideInset</item>
</style>
...
</style>
If you would prefer, you can override these styles to create a look and feel that better suits your app. To override a style, copy it in its entirety to the styles.xml
file in your project and make modifications. The whole style must be copied over to your local styles.xml
file for all of the attributes to be correctly set.
1
2
3
4
5
6
7
8
9
<style name="Braze.Feed.List">
<item name="android:background">@color/mint</item>
<item name="android:cacheColorHint">@color/mint</item>
<item name="android:divider">@android:color/transparent</item>
<item name="android:dividerHeight">16.0dp</item>
<item name="android:paddingLeft">12.5dp</item>
<item name="android:paddingRight">5.0dp</item>
<item name="android:scrollbarStyle">outsideInset</item>
</style>
1
2
3
4
<style name="Braze.Feed.List">
<item name="android:background">@color/mint</item>
<item name="android:cacheColorHint">@color/mint</item>
</style>
Feed style elements
The following is a description of the themeable Braze UI elements and their names for styling purposes:
Setting a custom font
Braze allows setting a custom font using the font family guide. To use it, override a style for cards and use the fontFamily
attribute to instruct Braze to use your custom font family.
For example, to update the font on all titles for short news cards, override the Braze.Cards.ShortNews.Title
style and reference your custom font family. The attribute value should point to a font family in your res/font
directory.
Here is a truncated example with a custom font family, my_custom_font_family
, referenced on the last line:
1
2
3
4
5
6
<style name="Braze.Cards.ShortNews.Title">
<item name="android:layout_height">wrap_content</item>
...
<item name="android:fontFamily">@font/my_custom_font_family</item>
<item name="fontFamily">@font/my_custom_font_family</item>
</style>