从后面的代码中知道 strings.xml 我在 Android 中使用的是什么
Know from behind code what strings.xml i'm using in Android
我可以从代码背后知道我正在使用的多语言应用程序中的哪个文件strings.xml吗?
请举个例子。
您可以在 运行 时间内通过更新您的资源配置来更改您的应用程序语言。喜欢这个代码:
Resources res=getResources();
Configuration config = res.getConfiguration();
Locale locale = new Locale("fr");//change to the France language
Locale.setDefault(locale);
config.locale = locale;
res.updateConfiguration(config, res.getDisplayMetrics());
我可以从代码背后知道我正在使用的多语言应用程序中的哪个文件strings.xml吗?
请举个例子。
您可以在 运行 时间内通过更新您的资源配置来更改您的应用程序语言。喜欢这个代码:
Resources res=getResources();
Configuration config = res.getConfiguration();
Locale locale = new Locale("fr");//change to the France language
Locale.setDefault(locale);
config.locale = locale;
res.updateConfiguration(config, res.getDisplayMetrics());