停止对字体改变活动启动 [英] Stop activity restart on font change
问题描述
每当我更改字体从活动开始的onCreate()。如何才能停止呢?
Whenever I change font activity starts from onCreate(). How can I stop this?
推荐答案
这样做的原因是,改变字体规模触发配置更改。你可以看到那个东西,火这些配置更改这里列表
The reason for this is that changing the font scale fires a configuration change. You can see a list of that things that fire these configuration changes here.
要避免它,你可以添加属性的android:configChanges =fontScale
- 但是你将需要处理该配置通过重写<一个改变自己href=\"http://developer.android.com/reference/android/app/Activity.html#onConfigurationChanged%28android.content.res.Configuration%29\"相对=nofollow> onConfigurationChanged()
。
To avoid it, you could add the attribute android:configChanges="fontScale"
- but you would then need to handle that configuration change yourself by overriding onConfigurationChanged()
.
我建议你阅读处理运行时更改前你继续。
I advise that you read about Handling Runtime Changes before you proceed.
这篇关于停止对字体改变活动启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!