Java 错误:未找到与给定名称匹配的资源:attr';字体'; 包装内容 包装内容 机械调节 机器人黑 45便士 @颜色/主颜色\u灰色\u 500
获取错误: 错误:(4,5)未找到与给定名称匹配的资源:attr'typeface'。 我正在使用Java 错误:未找到与给定名称匹配的资源:attr';字体'; 包装内容 包装内容 机械调节 机器人黑 45便士 @颜色/主颜色\u灰色\u 500,java,android,android-studio,android-support-library,Java,Android,Android Studio,Android Support Library,获取错误: 错误:(4,5)未找到与给定名称匹配的资源:attr'typeface'。 我正在使用 1.Android Studio 1.5.1 2.MinsdkVersion15 3.targetSdkVersion 23 我的布局文件是 <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> &
1.Android Studio 1.5.1
2.MinsdkVersion15
3.targetSdkVersion 23 我的布局文件是
<?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>
您应该使用
android:typeface
,而不是typeface
使用
<abcapp.com.font.RobotoTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ABC"
android:textSize="16sp"
app:typeface="robotoBlack" />
你的字体
Typeface类指定字体的字体和固有样式
字体
您应该调用android:typeface
,而不是typeface
不要
<item name="android:typeface">YOUR FONT</item>
机器人调节器
Do
<item name="typeface">robotoRegular</item>
机器人调节器
我正在xml布局文件中使用“app:typeface”。我刚刚在我的问题中添加了xml布局文件代码,但看起来你没有声明app
标签,比如android
。我在xml布局文件中使用了“app:typeface”。我刚刚在问题中添加了xml布局文件代码,我正在xml布局文件中使用“app:typeface”。我刚刚在我的文档中添加了xml布局文件代码question@smoke
<item name="android:typeface">robotoRegular</item>