Provide custom fonts

Change OpenWeb default fonts in your Android app

You can replace the OpenWeb Android SDK's default fonts with your own custom fonts. Using your own custom app fonts creates a seamless UI and branding experience for your users.

Add custom fonts

Use the following steps to add custom fonts to your app:

  1. In the app module in Android Studio, add your font to the res/font directory.

    In the following screenshot, three fonts have been added to the res/font directory:
       • big_shoulder_bold.ttf
       • big_shoulder_italic.ttf
       • big_shoulder_regular.ttf

  1. Create publisher_custom_font_family.xml file with the following code:
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <!-- regular -->
    <font
        android:font="@font/big_shoulder_regular"
        android:fontStyle="normal"
        android:fontWeight="400"

        app:font="@font/big_shoulder_regular"
        app:fontStyle="normal"
        app:fontWeight="400" />

    <!-- italic -->
    <font
        android:font="@font/big_shoulder_italic"
        android:fontStyle="normal"
        android:fontWeight="400"

        app:font="@font/big_shoulder_italic"
        app:fontStyle="italic"
        app:fontWeight="400" />

    <!-- bold -->
    <font
        android:font="@font/big_shoulder_bold"
        android:fontStyle="normal"
        android:fontWeight="700"

        app:font="@font/big_shoulder_bold"
        app:fontStyle="normal"
        app:fontWeight="700" />

</font-family>

  1. In res/values/styles.xml, add the following entries:
<style name="SpotIm.Theme.Dark.Language">
    <item name="android:fontFamily">@font/publisher_custom_font_family</item>
    <item name="fontFamily">@font/publisher_custom_font_family</item>
</style>

<style name="SpotIm.Theme.Light.Language">
    <item name="android:fontFamily">@font/publisher_custom_font_family</item>
    <item name="fontFamily">@font/publisher_custom_font_family</item>
</style>


Did this page help you?