字体大小更改时的活动重载

时间:2019-01-09 11:43:33

标签: android fonts onconfigurationchanged

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

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

我该如何实现?

谢谢

1 个答案:

答案 0 :(得分:0)

您在活动中查看它。 `覆盖乐趣 onConfigurationChanged(newConfig: Configuration) { 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