【问题标题】:Activity reaload when font size change字体大小更改时重新加载活动
【发布时间】:2019-01-09 11:43:33
【问题描述】:

我有一个包含 TextView、EditText 和 ImageView 的布局文件,当我进入设置屏幕并更改字体大小时,我必须重新加载上述活动运行时。

只有一个布局文件,每次更改字体大小时都应加载相同的文件以匹配新的字体大小。

我怎样才能做到这一点?

谢谢

【问题讨论】:

  • onresume of activity 你可以获取大小并将其设置为 textview
  • 不仅textview..布局作为一个整体我必须重新加载,与字体大小匹配,如果字体大小发生变化()会调用onConfigurationchange()?

标签: android fonts onconfigurationchanged


【解决方案1】:

您在活动中查看它。 `覆盖乐趣onConfigurationChanged(newConfig:配置){ super.onConfigurationChanged(newConfig)

// Checks the orientation of the screen
if (newConfig.orientation === Configuration.ORIENTATION_LANDSCAPE) {
    Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show()
} else if (newConfig.orientation === Configuration.ORIENTATION_PORTRAIT) {
    Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show()
}

` .更改您想要的文字大小后。 你可以按照这个解决方案:How to make font sizes in app to not get effected by changing Settings Font size

【讨论】:

    猜你喜欢
    • 2018-03-09
    • 2020-03-02
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-06
    • 2015-03-27
    相关资源
    最近更新 更多