android多语言切换
来源:互联网 发布:access数据库编辑器 编辑:程序博客网 时间:2024/06/01 09:26
string.xml英文<?xml version="1.0" encoding="utf-8"?><resources> <string name="TextView1">ONE</string> <string name="TextView2">TWO</string></resources>string.xml中文<?xml version="1.0" encoding="utf-8"?><resources> <string name="TextView1">第一个</string> <string name="TextView2">第二个</string></resources></span>
MainActivity.xml
package com.sec.lifeactivity;import java.util.Locale;import android.os.Bundle;import android.widget.TextView;import android.app.Activity;import android.content.res.Configuration;public class MainActivity extends Activity { TextView textView1; TextView textView2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);// 总是先调用上级类方法 setContentView(R.layout.activity_main); //默认英文 textView2 = (TextView) findViewById(R.id.textView2); textView2.setText(R.string.TextView2); Configuration configuration = getResources().getConfiguration();// 获取系统的配置 configuration.locale = Locale.CHINA; getResources().updateConfiguration(configuration, getResources().getDisplayMetrics()); textView1 = (TextView) findViewById(R.id.textView1); textView1.setText(R.string.TextView1); }}
0 0
- android多语言切换
- android多语言切换
- Android多语言切换
- Android多语言切换
- Android多语言切换
- Android App 多语言切换
- Android App 多语言切换
- Android App 多语言切换
- Android多语言,应用内切换语言
- Android中实现多语言的切换
- android实现多语言自动切换字体
- 【Android 多语言切换简单实例分享】
- android app 动态实现多语言切换
- Android应用实现多语言切换
- android多语言切换,代码简洁易懂
- Android国家化(多语言及切换)
- android 7.0 兼容多语言切换总结
- Android应用的多语言切换
- TCP、UDP、HTTP、SOCKET之间的区别
- POJ 1129 Channel Allocation DFS+四色定理
- nginx ngx_http_limit_req_module 简单防下CC攻击
- 数据结构之串
- Servlet的基本知识
- android多语言切换
- 【SPOJ DISUBSTR】Distinct Substrings 后缀数组
- html5标签总结
- 微信调用扫一扫的步骤(ASP实现方式)
- C语言:未包含头文件引起的奇怪错误
- React-Native Windows完全安装指南
- xtrabackup
- Android 高清加载巨图方案 拒绝压缩图片
- 005_Http之request获取客户端信息03-获取请求参数