最新链接app-compat
这是1.1.0 .
将我的应用程序升级到最新版本后 app-compat
我的语言设置在 以下的手机上停止工作API 24 (粗略地说,肯定不适用于 API 21 及以下版本)。
对于 API 24 及更高版本,我使用了 ContextWrapper
并设置 locale
因此有效。
我的问题是 androidx.appcompat:appcompat:1.1.0
是稳定版本为什么它在alpha
中对我有用和 beta
与这里的其他版本和我尝试过的问题不同的版本。
1.1.0
)Should I wait for an official stable version again and downgrade to the last stable version or which is the efficient way to let google know if any(ofcourse, I know to file a bug)?
最佳答案
编辑:
要继续使用 1.1.0 版,请将其添加到您的 attachBaseContext
下方。 :
Kotlin 解决方案:
override fun applyOverrideConfiguration(overrideConfiguration: Configuration?) {
if (overrideConfiguration != null) {
val uiMode = overrideConfiguration.uiMode
overrideConfiguration.setTo(baseContext.resources.configuration)
overrideConfiguration.uiMode = uiMode
}
super.applyOverrideConfiguration(overrideConfiguration)
}
Java 解决方案:
@Override
public void applyOverrideConfiguration(Configuration overrideConfiguration) {
if (overrideConfiguration != null) {
int uiMode = overrideConfiguration.uiMode;
overrideConfiguration.setTo(getBaseContext().getResources().getConfiguration());
overrideConfiguration.uiMode = uiMode;
}
super.applyOverrideConfiguration(overrideConfiguration);
}
If you don't need to upgrade to the latest
appCompat
then check the old answer. Else use the solution provided by @0101100101 here.
旧答案:
花了几个小时尝试后,才知道这可能是一个错误。
降级 到最后一个稳定版本,它可以完美运行。
dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2' //************ DO NOT UPGRADE LANGUAGE ISSUE on API 23 and below *******************//
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
....
}
同时,我向 Google https://issuetracker.google.com/issues/140880275 提交了一个问题。
关于android - 更新到 androidx.appcompat :appcompat:1. 1.0 后的语言更改问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57900554/