<RadioButton android:id="@+id/RadioButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text"
android:drawableLeft="@drawable/icon"
android:drawableRight="@drawable/icon"
android:drawableTop="@drawable/icon"
android:drawableBottom="@drawable/icon" />

有时候为了使版本能够适用不同的地区 而选择了不同文件夹

其实有时候还可以强制使用

<activity android:name=".M1" android:configChanges="locale" android:label="@string/app_name" />
一定要加上啊

然后呢代码

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String languageToLoad = "cn";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
this.setContentView(R.layout.main);
}
剩下的就很简单了

你要做的就是 在main假设存在一个button,你想在上面设置文字 ,你想有英文的或者中文的,但是你想你手机使用的时候先强制使用中文

那么你只需要在

res中新建一个文件夹 values-cn 然后里面的参数和vvalues中的string一样就可以了 只要内容不同

然后你运行程序就会发现 原来先运行的是中文的

3.

String msg = getResources().getString(R.string.text_c);

msg = java.text.MessageFormat.format(msg, "foo", "bar", locale);

<string name="text_c">This string uses message formatting. In the current locale, {1} comes before {0} and the current locale is {2}.</string>

更多相关文章

  1. android listview custom style 自定义样式
  2. Android——SQLite/数据库 相关知识总结贴
  3. android中searchable的使用
  4. Android日历控件
  5. Android(安卓)Studio中Gradle使用详解
  6. 用HTML5开发Android应用程序
  7. Android(安卓)之使用Android(安卓)Studio(AS)命令打release包
  8. [置顶] Android(安卓)使用Android(安卓)Studio + Gradle 或 命令
  9. Android(安卓)项目优化(七):阿里巴巴Android开发手册整理总结

随机推荐

  1. Android Studio : 导入项目出现 peer not
  2. Android编译错误Execution failed for ta
  3. Android 添加新的联系人代码
  4. [Android]Generating Keys
  5. Android 球碰撞反弹 (2)
  6. Android中的RecyclerView学习网址
  7. android 6.0权限问题处理的核心代码--sho
  8. 在android 只取vold相关的log信息
  9. Android Question - “Id cannot be reso
  10. android 获取系统和SD卡音乐