gpt4 book ai didi

android - 使用支持库的 XML 字体

转载 作者:行者123 更新时间:2023-12-04 17:02:12 24 4
gpt4 key购买 nike

我想通过 XML 字体资源目录设置字体,但在 font.xml文件同时使用 app:fontStyle , app:fontWeightapp:font gadle 构建失败并出现错误

/media/shankar/Work Drive/temp/BrainColors/app/src/main/res/font/fonts.xml

Error:attribute 'com.color.brain.braincolors:font' not found Error:attribute 'com.color.brain.braincolors:fontStyle' not found Error:attribute 'com.color.brain.braincolors:fontWeight' not found

Error:/media/shankar/Work Drive/temp/BrainColors/app/src/main/res/font/fonts.xml:0 attribute 'com.color.brain.braincolors:font' not found Error:/media/shankar/Work Drive/temp/BrainColors/app/src/main/res/font/fonts.xml:0 attribute 'com.color.brain.braincolors:fontWeight' not found Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed: Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed: Error:Execution failed for task ':app:processDebugResources'. Failed to execute aapt



我不明白为什么在使用 app: 时会出现这种情况命名空间

fonts.xml
<font-family xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<font android:fontStyle="normal" android:fontWeight="400" android:font="@font/junegull"
app:fontStyle="normal" app:fontWeight="400" app:font="@font/junegull"/>

</font-family>

最佳答案

您可以查看本教程如何在 xml 中使用字体
fonts-in-xml

我认为您缺少 android 支持库 26.0

关于android - 使用支持库的 XML 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46483415/

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