gpt4 book ai didi

android - Android 上究竟何时加载 "preloaded fonts"?

转载 作者:行者123 更新时间:2023-12-03 17:13:21 25 4
gpt4 key购买 nike

当我使用 Downloadable Fonts Android 上的功能,我可以通过将此代码添加到 AndroidManifest.xml 来添加预加载策略:

<meta-data android:name="preloaded_fonts" 
android:resource="@array/preloaded_fonts" />

这究竟是什么时候加载的?在应用程序启动时?安装时?如果它在应用程序启动时,并且我使用 上的字体第一个屏幕 ,有任何性能差异吗?

最佳答案

https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts#predeclaring-fonts

Layout inflation and resource retrieval are synchronous tasks. Bydefault, the first attempt to retrieve fonts triggers a request to thefont provider, and therefore increases the first layout time. To avoidthe delay, you can pre-declare fonts that need retrieving in yourmanifest. After the system retrieves the font from the provider, it isavailable immediately. If the font retrieval takes longer thanexpected, the system aborts the fetching process and uses the defaultfont.

关于android - Android 上究竟何时加载 "preloaded fonts"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57522949/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com