Android Studio TextView fontFamily在主题中不起作用
我的activity_main.xml中有一个TextView,我想更改它的fontFamily属性。它适用于AppTheme和AppCompat主题: 但是,在其他主题(如材质主题)中,字体系列始终设置为默认: 是因为主题不支持这些字体还是我做错了什么 activity_main.xml:Android Studio TextView fontFamily在主题中不起作用,android,xml,android-studio,fonts,font-family,Android,Xml,Android Studio,Fonts,Font Family,我的activity_main.xml中有一个TextView,我想更改它的fontFamily属性。它适用于AppTheme和AppCompat主题: 但是,在其他主题(如材质主题)中,字体系列始终设置为默认: 是因为主题不支持这些字体还是我做错了什么 activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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=".MainActivity">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is some text"
android:textColor="@android:color/background_light"
android:textSize="50sp"
app:fontFamily="cursive"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.223" />
</android.support.constraint.ConstraintLayout>
尝试在xml中同时使用app:fontFamily
和android:fontFamily
尝试将活动类的扩展活动更改为扩展AppCompatActivity
。它适用于我使用androidx.appcompat.widget.AppCompatTextView
与TextView不同。同样的事情也发生在我身上,我在emulator上运行时更改了字体系列,但没有更改我的应用程序。幸运的是,我卸下了用于安装应用程序的usb电缆,将其从最近的应用程序中清除,再次运行,在这里一切正常。字体系列已更改为我设置的字体。您是否计划在应用程序中使用多个主题?你可以尝试添加任何字体(此处)[并使其可用于所有主题的整个应用程序。我正在尝试将材质主题用于这些字体fonts@Caleb你找到解决办法了吗?