【问题标题】:Device font style theme prevent TextView Typeface to change the font on huawei device设备字体样式主题防止TextView Typeface改变华为设备上的字体
【发布时间】:2021-01-04 05:43:37
【问题描述】:

我正在尝试使用这样的字体更改我的文本视图的字体

Typeface tf = Typeface.createFromAsset(context.getAssets(), "fontName.ttf"));
TextView textView = (TextView) findViewById(R.id.textView1);
textView.setTypeface(tf);

但是华为设备有一个字体样式自定义,如果你在那里改变字体,它会改变整个设备的字体,包括我的 textView 我怎样才能防止这种情况发生?

【问题讨论】:

    标签: android android-fonts android-typeface


    【解决方案1】:

    如果您在 xml 中使用 fontFamilytypeface 属性,请删除主题。您也可以使用Calligraphy 项目,该项目可以直接从布局xml 实际设置自定义字体。

    【讨论】:

      猜你喜欢
      • 2013-10-16
      • 1970-01-01
      • 2020-03-01
      • 1970-01-01
      • 2011-12-26
      • 1970-01-01
      • 2012-03-23
      • 1970-01-01
      相关资源
      最近更新 更多