作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 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/
我是一名优秀的程序员,十分优秀!