使用机器人多语言支持动态改变的语言? [英] Change language dynamically using androids multilanguage support?

查看:125
本文介绍了使用机器人多语言支持动态改变的语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时有办法在一个应用程序中使用的机器人不同的语言之间进行切换多语言支持(值德文件夹,德语和值恩文件夹中英文)?

Is there are way to switch between different languages within an app using androids multilanguage support (values-de folder for german and value-en folder for english)?

推荐答案

这是不是真的支持,但可以通过改变配置对象的区域设置字段[Google论坛帖子]

This is not really supported but possible by changing the Configuration object's "locale" field [Google Groups Post]

Configuration c = new Configuration(getResources().getConfiguration());
c.locale = Locale.GERMAN;
getResources().updateConfiguration(c, getResources().getDisplayMetrics());

请注意,这本身将不仅影响今后的字符串,而不是那些在屏幕上已经显示。你会想从比你的主要的一个不同的活动做到这一点,然后完成你的主要之一,并重新启动它。 这是哈克。请参见后从Hackborn

Note that this alone will only effect future strings, not ones already displayed on the screen. You'd want to do this from a different activity than your main one, then finish your main one and restart it. This is hacky. See Post from Hackborn

这篇关于使用机器人多语言支持动态改变的语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆