We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在onConfigurationChanged中设置完语言后,将设置语言时返回的context的resource传递给AutoSizeCompat,即可保证二者使用同一个resource,避免其中一方失效的问题。根据自己的需求调用autoConvertDensity传需要的宽高和是否根据宽度适配等待。参考:#13 (comment)
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); String language = AppConfig.INSTANCE.getAppLanguage(); // 对应语言环境下的context Context context = LanguageManager.INSTANCE.setLocale(this, language); //需要升级到 v1.1.2 及以上版本才能使用 AutoSizeCompat //修复设置语言后,Autosize失效的问题 if (newConfig.orientation != Configuration.ORIENTATION_LANDSCAPE) { // 纵向 AutoSizeCompat.autoConvertDensity(context.getResources(), 0, true);//如果有自定义需求就用这个方法 } else { // 横向 AutoSizeCompat.autoConvertDensity(context.getResources(), 1280, true);//如果有自定义需求就用这个方法 } } @Override public void attachBaseContext(Context newBase ) { String language = AppConfig.INSTANCE.getAppLanguage(); // attach对应语言环境下的context Context context = LanguageManager.INSTANCE.setLocale(newBase , language); super.attachBaseContext(context); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在onConfigurationChanged中设置完语言后,将设置语言时返回的context的resource传递给AutoSizeCompat,即可保证二者使用同一个resource,避免其中一方失效的问题。根据自己的需求调用autoConvertDensity传需要的宽高和是否根据宽度适配等待。参考:#13 (comment)
The text was updated successfully, but these errors were encountered: