Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: No resource found that matches the given name: attr 'typeface'

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

    <style name="TextViewAppearance" parent="@android:style/TextAppearance.Widget.TextView">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="typeface">robotoRegular</item>            
    </style>

    <style name="TextViewAppearance.Display1" parent="@style/TextViewAppearance">
        <item name="typeface">robotoBlack</item>
        <item name="android:textSize">45sp</item>
        <item name="android:textColor">@color/main_color_grey_500</item>
    </style>
</resources>

Getting Error: Error:(4, 5) No resource found that matches the given name: attr 'typeface'.

I'm using
1. Android Studio 1.5.1
2. minSdkVersion 15
3. targetSdkVersion 23

<----------- Edit --------------------->

My Layout file is

<abcapp.com.font.RobotoTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"               
                android:text="ABC"               
                android:textSize="16sp"
                app:typeface="robotoBlack" />
like image 676
Ali Avatar asked Jan 22 '16 06:01

Ali


2 Answers

The Typeface class specifies the typeface and intrinsic style of a font.

You should call android:typeface instead of typeface .

Don't

<item name="typeface">robotoRegular</item>

Do

<item name="android:typeface">robotoRegular</item>
like image 158
IntelliJ Amiya Avatar answered Nov 16 '22 04:11

IntelliJ Amiya


you should use android:typeface,not typeface.

like image 1
starkshang Avatar answered Nov 16 '22 03:11

starkshang