[英]Element font-family is not allowed here anymore : Android Studio
每當我嘗試在XML中包含字體時,都會出現標題中提到的錯誤。 這是XML代碼。
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".home_screen">
<font-family>
<font>
</font>
</font-family>
<EditText
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:gravity="center"
android:inputType="textPersonName"
android:singleLine="true"
android:text="HOME ACTIVATOR"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.03" />
</android.support.constraint.ConstraintLayout>
當我將鼠標懸停在“字體家族”標簽上時,我看到了android studio指出的問題。 可能是文檔錯誤? 我正在按照官方google開發人員頁面上的在線指南進行操作-https: //developer.android.com/guide/topics/resources/font-resource
這個問題剛剛解決,看起來我使用的是API級別22,當時只能在API級別26中使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.