XML字体无法在模拟器API上使用23 [英] Fonts in XML not working on emulator API 23

查看:79
本文介绍了XML字体无法在模拟器API上使用23的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用字体XML ,但在模拟器上有问题.

I'm trying to use Fonts in XML, but have problems on Emulator.

在具有Android 23 API的设备上可以正常工作,但由于某些原因,在具有相同版本的仿真器上,不会下载字体并且未应用字体.

On the device with the Android 23 API works correctly, but on the emulator with the same version for some reason the fonts are not downloaded and are not applied.

我使用了默认的Android Studio 3 仿真器(API 23,系统映像x86).

I used default Android Studio 3 Emulator (API 23, System image x86).

有趣的是,在使用API​​ 27的仿真器上,一切正常,并且已应用字体.

It's interesting that on the emulator with the API 27 everything works well and the fonts are applied.

我的app.gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "by.mastihin.testnewcustomfonts"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:27.0.2"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

GitHub上的整个项目代码

这对我来说不是一个大问题,找出原因很有趣.谢谢!

推荐答案

自动下载字体"系统由Google Play服务管理.

The "auto-downloaded-fonts" system is managed by Google Play Services.

它已安装在所有真实" Android设备上,因此可以在其中运行.

This is installed on all "real" Android devices, so it'll work there.

但是大多数仿真器未安装Google Play服务,因此无法在其中运行.直到最近Google才发布实际安装了Google Play服务的模拟器.

But most emulators do NOT have Google Play Services installed, so they won't work there. It's only recently that Google published emulators which actually have Google Play Services installed.

检查是否在2个仿真器上安装了它们,我猜API 23一个没有,而更新的API 27一个.

Check if you have them installed on your 2 emulators, and i'm guess that the API 23 one does not have them, while the newer, API 27 one, does.

这篇关于XML字体无法在模拟器API上使用23的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆