该问题通常是由于设备的语言设置与应用程序的语言设置不同步造成的。最简单的解决方法是在application标签中添加android:configChanges="locale"属性,如下所示:
在编辑文本框之前,您可以尝试使用以下方法将语言更改回设备的语言:
private void updateLocale(String localeCode) { Locale locale = new Locale(localeCode); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getResources().updateConfiguration(config, getResources().getDisplayMetrics()); }
该方法将应用程序的语言更改为设备的语言。
如果您的应用程序具有多种语言支持,请确保在strings.xml文件中包含所有支持的语言,并在程序启动时正确初始化语言。
希望这能帮助您解决Android appcompat edittext输入自动更改为选择的语言文本问题。
上一篇:AndroidAppBundle中的无限循环握手问题
下一篇:Androidappdevelopmentwithandroidauto.Problemwithviewwhendisplayedondifferentdevices