Error: No resource found that matches the given name: attr 'typeface'
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>
获取错误:
错误:(4, 5) 找不到与给定名称匹配的资源:attr 'typeface'.
我正在使用
1.Android Studio 1.5.1
2. minSdkVersion 15
3. targetSdkVersion 23
<------------ 编辑-------------------->
我的布局文件是
<abcapp.com.font.RobotoTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ABC"
android:textSize="16sp"
app:typeface="robotoBlack" />
你应该使用 android:typeface
,而不是 typeface
。
使用
<item name="android:typeface">YOUR FONT</item>
The Typeface class specifies the typeface and intrinsic style of a
font.
您应该调用 android:typeface
而不是 typeface
。
不要
<item name="typeface">robotoRegular</item>
做
<item name="android:typeface">robotoRegular</item>
<?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>
获取错误: 错误:(4, 5) 找不到与给定名称匹配的资源:attr 'typeface'.
我正在使用
1.Android Studio 1.5.1
2. minSdkVersion 15
3. targetSdkVersion 23
<------------ 编辑-------------------->
我的布局文件是
<abcapp.com.font.RobotoTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ABC"
android:textSize="16sp"
app:typeface="robotoBlack" />
你应该使用 android:typeface
,而不是 typeface
。
使用
<item name="android:typeface">YOUR FONT</item>
The Typeface class specifies the typeface and intrinsic style of a font.
您应该调用 android:typeface
而不是 typeface
。
不要
<item name="typeface">robotoRegular</item>
做
<item name="android:typeface">robotoRegular</item>