如何获取与选择自定义本地化相关的图像?
我正在尝试用不同的语言实现我的应用程序。文本更改很好,但我不知道正在根据区域设置(自定义)的选择检索图像。
我遵循以下代码:
我的字符串放在资源文件夹中:res/values-xx /string.xml
Locale locale=new Locale("xx");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());
这对于文本工作正常。让我知道如何实现这一点。我只是尝试将图像放入 res/drawable-xx/some.png 中,但它对我不起作用。请给我一些建议..
I am trying to implement my app in different languages. Text changes are fine but i didn't get any idea of that images are retrieving with respect to selection of locale(custom).
i follow the below code:
My string are put in resource folder: res/values-xx /string.xml
Locale locale=new Locale("xx");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());
This is working fine for text. Let me know how to implement this. I just tried to put images in res/drawable-xx/some.png ,but it doesn't working for me. Please give me some suggestions..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,终于我找到了解决方案。这里 xx 是语言代码。
这非常简单,只需将布局声明为layout-xx,并且您的可绘制文件夹应声明为drwable-xx。
Yes Finally i got the solution for it.Here xx is Language code.
This is very simple by declaring layout as layout-xx and your drawable folder should be declared as drwable-xx.