【发布时间】:2018-04-04 02:11:08
【问题描述】:
我的activity_main.xml 中有一个TextView,我想更改它的fontFamily 属性。它适用于 AppTheme 和 AppCompat 主题:
但是,在 Material 主题等其他主题中,字体系列始终设置为默认值:
是主题不支持这些字体还是我做错了什么?
activity_main.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>
【问题讨论】:
-
您是否打算在您的应用程序中包含多个主题?您可以尝试添加任何字体(此处)[developer.android.com/guide/topics/ui/look-and-feel/… 并使其可用于具有所有主题的整个应用程序。
-
我正在尝试将材料主题与这些字体一起使用
-
@Caleb 你找到解决方案了吗?
标签: android xml android-studio fonts font-family