Skip to content
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

手机系统字体大小改了之后,APP里面的字变得非常大,有什么办法去处理吗,或者不让APP随着系统改变 #327

Open
clbDream opened this issue Dec 7, 2020 · 2 comments

Comments

@clbDream
Copy link

clbDream commented Dec 7, 2020

用这个方法没用,updateConfiguration也过时了
@Override public Resources getResources() { Resources resources = super.getResources(); if (resources != null) { Configuration configuration = resources.getConfiguration(); if (configuration != null && configuration.fontScale != 1.0f) { configuration.fontScale = 1.0f;//这里只设置字体,故不使用下面注释的方法 // configuration.setToDefaults(); resources.updateConfiguration(configuration, resources.getDisplayMetrics()); } } return resources; }

@ChawLoo
Copy link

ChawLoo commented Feb 3, 2021

override fun getResources(): Resources? {
    if (ThreadPoolUtils.isMainThread()) {
        AutoSizeCompat.autoConvertDensityOfGlobal(super.getResources()) //如果没有自定义需求用这个方法
    }
    return super.getResources()
}

Duplicate of #13 里面提到了

@xiaoxing0828
Copy link

// App 内的字体大小不跟随系统设置中字体大小的改变
AutoSizeConfig.getInstance().setExcludeFontScale(true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants