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)
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With