问题
我们正在更改应用程序内的区域设置,除了指纹对话框中的提示外,一切正常。无论我们设置什么语言,我们总是有英文提示:
- 触摸指纹传感器
- 不认识
- 等...
环境
- 使用的组件:androidx.biometric.BiometricPrompt
- 使用的版本:1.0.0.0-alpha04
- 设备/Android 版本转载于:模拟器 API 28
语言环境是如何设置的:
private fun setNewLocaleAndRestart(language: String) {
LocaleManager(this).setNewLocale(language)
//restarting app
val i = Intent(this, SplashScreenActivity::class.java)
startActivity(i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK))
finish()
System.exit(0)
}
class LocaleManager(val context: Context) {
val sharedPreferenceManager = createSharedPreferenceManager(context)
fun setLocale(): Context = updateResources()
fun setNewLocale(language: String): Context {
return updateResources(language)
}
private fun updateResources(l: String? = null): Context {
val language = l ?: sharedPreferenceManager.language
if (language.isBlank()) return context
val locale = Locale(language)
Locale.setDefault(locale)
val res = context.resources
val config = Configuration(res.configuration)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
config.setLocale(locale)
return context.createConfigurationContext(config)
} else @Suppress("DEPRECATION") {
config.locale = locale
res.updateConfiguration(config, res.displayMetrics)
return context
}
}
}
最佳答案
everything works except the hints in the fingerprint dialog
所有系统对话框都将使用用户为设备设置的语言。这包括用于生物识别的系统对话框。
关于android - BiometricPrompt 提示未本地化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56046832/