$sudo vi /var/lib/locales/supported.d/local
改為en_US.UTF-8 UTF-8
修改
$sudo /etc/default/locale
改為LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
LANGUAGE="en_US:en"
======Code=============================
package tw.cww.tipcalculator;
import java.util.Locale;
import android.app.Activity;
import android.content.res.Configuration;
import android.content.res.Resources; import android.os.Bundle;
import android.util.DisplayMetrics;
public class TipCalculator extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Resources res = getResources();
Configuration conf = res.getConfiguration();
conf.locale = Locale.TRADITIONAL_CHINESE;//中文
DisplayMetrics dm = res.getDisplayMetrics();
res.updateConfiguration(conf, dm);
setContentView(R.layout.main);
}
}