Ali*_*Ali 5 java android android-support-library android-studio
<?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>
Run Code Online (Sandbox Code Playgroud)
获取错误: 错误:(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" />
Run Code Online (Sandbox Code Playgroud)
Typeface类指定字体的字体和内在样式.
你应该打电话android:typeface而不是typeface.
别
<item name="typeface">robotoRegular</item>
Run Code Online (Sandbox Code Playgroud)
做
<item name="android:typeface">robotoRegular</item>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4286 次 |
| 最近记录: |