Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 切换文本视图不显示可下载字体_Android_Android Support Library_Android Switch_Android Downloadable Fonts - Fatal编程技术网

Android 切换文本视图不显示可下载字体

Android 切换文本视图不显示可下载字体,android,android-support-library,android-switch,android-downloadable-fonts,Android,Android Support Library,Android Switch,Android Downloadable Fonts,我正在使用一个应用程序,它工作正常,但是当我尝试将字体应用到交换机的TextView时,我的设备不会显示它,而是使用默认字体-它在交换机组件之外的同一活动中为TextView正确显示字体 奇怪的是,Android Studio布局设计窗口显示了正确的字体,但在设备上运行时,它似乎无法正常工作 <Switch android:id="@+id/switch1" android:layout_width="0dp" android:layout_height="wrap

我正在使用一个应用程序,它工作正常,但是当我尝试将字体应用到交换机的TextView时,我的设备不会显示它,而是使用默认字体-它在交换机组件之外的同一活动中为TextView正确显示字体

奇怪的是,Android Studio布局设计窗口显示了正确的字体,但在设备上运行时,它似乎无法正常工作

<Switch
    android:id="@+id/switch1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:fontFamily="@font/baloo_bhai"
    android:text="This is a switch"
    android:theme="@style/AppTheme.Switch"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/editText2" />
这是Android Studio中的显示:

这是从我的设备:


这是一个众所周知的问题

修复程序位于另一个位置,但是可下载字体将无法使用此方法-在解决之前,字体文件必须嵌入到应用程序中,因为.XML字体将无法工作

干得好,谷歌