-
Notifications
You must be signed in to change notification settings - Fork 2k
Android14 设置不跟随系统字体大小改变失效 #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
找到解决办法了吗?现在setExcludeFontScale(true);无效 |
应用内有设置语言,然后在attachBaseContext里面设置fontScale为1,可以解决 |
在Activity内做如下调整可以解决
|
本质原因是Android14开始,字体缩放是非线性的,导致DisplayMetrics.scaledDensity这个方法失效,AutoSize在初始化字体缩放时失败。 |
是在application里写,还是把所有activity都要写一遍?或者直接通过baseActivity写一遍? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Bug Description:
//是否屏蔽系统字体大小对 AndroidAutoSize 的影响, 如果为 true, App 内的字体的大小将不会跟随系统设置中字体大小的改变
//如果为 false, 则会跟随系统设置中字体大小的改变, 默认为 false
AutoSizeConfig.getInstance().setExcludeFontScale(true);
设置了以上代码在安卓14中更改系统字体,app内字体还是会跟着变大(改变),在安卓14以下设备则有效
Log:
Screenshot
Related Code:
Others:
在真机上,小米14(Android14)上面测试也是这个问题。
Android14还有一个问题就是 AutoSizeCompat.autoConvertDensityOfGlobal((super.getResources()));导致软键盘无法弹出。
删除以下代码解决了
@OverRide
public Resources getResources() {
//需要升级到 v1.1.2 及以上版本才能使用 AutoSizeCompat
AutoSizeCompat.autoConvertDensityOfGlobal((super.getResources()));
return super.getResources();
}
The text was updated successfully, but these errors were encountered: