【问题标题】:change font type of item in string array更改字符串数组中项目的字体类型
【发布时间】:2016-06-15 11:59:17
【问题描述】:

我的 strings.xml 中有一个字符串数组,我想将字体类型更改为我的资产文件夹中的字体类型。下面是我在 strings.xml 中的代码示例:

<string-array name="htmlstrings">
<item>BBQ Steak  marinated BBQ Steak  &lt;b&gt;Regular&lt;b&gt;   Medium    Large  sh 500   sh 700  sh 900</item>
</string-array>

我用于检索文本的 Java 代码如下:

String[] htmlstrings = getResources().getStringArray(R.array.htmlstrings);
description.setText(Html.fromHtml(htmlstrings[x]));

从那里我不知道如何将不同的字体类型应用于项目内的文本。请帮忙。

【问题讨论】:

    标签: android arrays textview font-face


    【解决方案1】:

    这是stackoverflow中的常见答案..在提问之前搜索..

    这是你的答案

    Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/verdana.ttf");  
    description.setTypeface(tf,Typeface.BOLD);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-22
      • 1970-01-01
      • 1970-01-01
      • 2017-08-23
      • 2014-01-16
      • 2011-06-29
      相关资源
      最近更新 更多