5

I have one custom TextView whose name is TextViewPlus. I want to add style for my custom TextView. when i write this to styles.xml it hasn't work. The error is :

error: Error: No resource found that matches the given name: attr 'foo:customFont'.

this is styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources
    xmlns:foo="http://schemas.android.com/apk/res/com.example">

    <style name="textstyle" parent="@android:style/TextAppearance">
        <item name="android:textSize">50sp</item>
        <item name="foo:customFont">Fonts/BZar.ttf</item>
    </style>
</resources>

Notice that I get my custom TextView from Custom fonts and XML layouts (Android)

Community
  • 1
  • 1
Hosein Bitaraf
  • 425
  • 3
  • 15

1 Answers1

2

I resolve this issue by delete the namespace tag. change:

<style name="textstyle" parent="@android:style/TextAppearance">
    <item name="android:textSize">50sp</item>
    <item name="foo:customFont">Fonts/BZar.ttf</item>
</style>

to:

<style name="textstyle" parent="@android:style/TextAppearance">
    <item name="android:textSize">50sp</item>
    <item name="customFont">Fonts/BZar.ttf</item>
</style>
mrz
  • 71
  • 3