1

The app works with mindSdkVersion 23 and has targetedSdkVersion 27.

The device I work with is an Samsung Galaxy S6 Edge on Version with Android 7.0 (API 24).

All my fonts are shown correct in the Android Studio Preview, but I dont know what I am doing wrong, that the fonts wont work on my device. I tried lots of ideas. At least I read it will go with an additional android library. But that has not solved my problem.

Is there anybody with an idea? Its really important for me. I am frustrated.

Thanks for your help!

I have created my own font family at a folder "fonts" inside the drawable folder:

copperplate.xml:

<?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">

    <!--Copperplate Medium-->
    <font
        android:font="@font/copperplate_medium"
        android:fontStyle="normal"
        android:fontWeight="400"

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

</font-family>

The "copperplate_medium" I use in this case, is also put at the fonts folder. Its "copperplate_medium.otf"

layout.xml:

  <TextView
       android:id="@+id/title"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_centerHorizontal="true"
       android:layout_marginTop="180dp"
       android:text="@string/title"
       android:fontFamily="@font/copperplate_medium"
       app:fontFamily="@font/copperplate_medium" 
       android:textColor="@color/white"
       android:textSize="30sp />

1 Answers1

0

It looks like you have created copperplate.xml with changed font attributes but still reference original file android:fontFamily="@font/copperplate_medium" at the layout. Make sure to double check that you reference correct files

src/main/res/font/copperplate.xml
src/main/res/font/copperplate_medium.otf

and

<TextView
       ...
       android:fontFamily="@font/copperplate"
       />
Sergii Pechenizkyi
  • 22,227
  • 7
  • 60
  • 71