gpt4 book ai didi

android - 如何在 String.xml 文件中使用自定义字体

转载 作者:行者123 更新时间:2023-11-29 15:29:45 31 4
gpt4 key购买 nike

我在 String.xml 文件中使用了以下代码。现在我的问题是我使用字体作为 Aerial。那么有什么方法可以让我使用我的自定义字体而不是在这里使用 aerial ..假设我的自定义字体是 aa.ttf...那么我如何在这里使用它。我的代码是

<string name="strt_dialog_desc">To start monitoring press and hold the date on which the latest cycle started.<![CDATA[<font face=Aerial>]]>Click OptionMenu for help!<![CDATA[</font>]]></string>

最佳答案

//将你的字体放在 Assets 文件夹中

TextView tv=(TextView)findViewById(R.id.custom);
Typeface face=Typeface.createFromAsset(getAssets(),"fonts/aerial.ttf");

tv.setTypeface(face);
tv.setText(R.string.strt_dialog_desc);

关于android - 如何在 String.xml 文件中使用自定义字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8151297/

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