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{
@Overridepublic 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對象");
}
}