zoukankan      html  css  js  c++  java
  • Android本地语言和多国语言支持

    Android 有关多国语言支持的相关属性。利用下面代码打印系统相关属性值。具体属性可以查文档。
     
     
     
    package com.example;
     
    import android.app.Activity;
    import android.content.res.Configuration;
    import android.os.Bundle;
    import android.widget.TextView;
    import org.w3c.dom.Text;
     
    import java.util.Locale;
     
    public class MyActivity extends Activity
    {
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
     
    Locale locale = this.getResources().getConfiguration().locale;
     
    StringBuffer sb = new StringBuffer();
     
    sb.append("locale.toString():" + locale.toString());
    sb.append("\nlocale.getCountry():" + locale.getCountry());
    sb.append("\nlocale.getDisplayCountry():" + locale.getDisplayCountry());
    sb.append("\nlocale.getDisplayLanguage():" + locale.getDisplayLanguage());
    sb.append("\nlocale.getDisplayName():" + locale.getDisplayName());
    sb.append("\nlocale.getDisplayVariant():" + locale.getDisplayVariant());
    sb.append("\nlocale.getISO3Country():" + locale.getISO3Country());
    sb.append("\nlocale.getISO3Language():" + locale.getISO3Language());
    sb.append("\nlocale.getLanguage():" + locale.getLanguage());
    sb.append("\nlocale.getVariant():" + locale.getVariant());
     
    TextView textView = (TextView)this.findViewById(R.id.text);
    textView.setText(sb.toString());
     
    this.setTitle("local对象");
    }
    }
     
  • 相关阅读:
    H5版俄罗斯方块(5)---需求演进和产品迭代
    vim 常用 NERDTree 快捷键
    C和C++中include 搜索路径的一般形式以及gcc搜索头文件的路径
    MySQL复制协议
    深入解析MySQL replication协议
    Install CodeBlocks in CentOS 7
    Impala 源码分析-FE
    Elasticsearch 6.x 的分页查询数据
    1、树莓派3B开箱+安装系统
    Python创建ES索引
  • 原文地址:https://www.cnblogs.com/mythou/p/3132211.html
Copyright © 2011-2022 走看看