赞
踩
- Locale locale = Constants.context.getResources().getConfiguration().locale;
- String language = locale.getLanguage();//“zh”为中文,“en”为英文...
//其中android:configChanges="locale|layoutDirection|navigation|fontScale"作用就是不跟随系统语言变化</span>
- <activity
- android:name=".MainActivity"
- android:configChanges="locale|layoutDirection|navigation|fontScale"
- android:launchMode="singleTask"
- android:screenOrientation="portrait"/>
- Configuration config = UIUtils.getResources().getConfiguration();
- if (”添加条件“) {//切换中文
- config.locale = Locale.CHINA;
- } else {//切换英文
- config.locale = Locale.ENGLISH;
- }
- //更新配置环境
- getContext().getResources().updateConfiguration(config, null);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。