重點有二
- 在activity set content之前寫死字型大小
- 字型大小: resource的fontscale數值
val resources: Resources = myactivity.getResources()
var fontScale:Float = 1.0f
if (resources != null && resources.getConfiguration().fontScale !== fontScale) {
val configuration: Configuration = resources.getConfiguration()
configuration.fontScale = fontScale
resources.updateConfiguration(configuration, resources.getDisplayMetrics())
}
// 在set content之前
setContent {
}