0

英語とギリシャ語の多言語アプリを作ろうとしています。私が欲しいのは、最初の画面に言語を選択する2つのボタンがあり、他のすべてのアプリがその言語でbveすることだけです。私は2つのボタンと段落で簡単なテストプロジェクトを作成しました。英語のボタンを押すとテキストは英語になり、ギリシャ語のボタンを押すとテキストはギリシャ語になります。私のコード

    @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_page2);

    Button english = (Button) findViewById(R.id.english);
    english.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Locale locale = new Locale("en_UK"); 
            Locale.setDefault(locale);
            Configuration config = new Configuration();
            config.locale = locale;

            getApplicationContext().getResources().updateConfiguration(config, null);
    Intent intent = new Intent(v.getContext(), MainActivity.class);
            startActivityForResult(intent, 0);
        }

    });
    Button greek = (Button) findViewById(R.id.greek);
    greek.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Locale locale = new Locale("el_GR"); 
            Locale.setDefault(locale);
            Configuration config = new Configuration();
            config.locale = locale;

            getApplicationContext().getResources().updateConfiguration(config, null);
            Intent intent = new Intent(v.getContext(), MainActivity.class);
            startActivityForResult(intent, 0);
        }

    });



}

英語の段落を含むstrings.xmlは元のres/valuesフォルダーにあり、ギリシャ語を含むstrings.xmlはres/values-elにあります

テスト アプリの 3 つのスクリーンショットを次に示します。いくつかのスクリーンショットを次に示します。

http://s18.postimg.org/dw0dvdsr9/Screenshot_2013_09_04_15_27_58.png

http://s18.postimg.org/6u2g96p5h/Screenshot_2013_09_04_15_28_08.png

http://s18.postimg.org/7kv6eyrit/Screenshot_2013_09_04_15_28_14.png

文字以外のものがあるのはギリシャ語の段落です

4

1 に答える 1

0

問題は、お使いの携帯電話がギリシャ語の Unicode 文字をサポートしていないことです。2 つの解決策があります。

1)これは、お使いのデバイスで使用されているフォントがギリシャ文字をサポートしていないことを意味します (したがってunknown unicode)。より良いフォントを見つけて、アプリケーションで使用する必要があります ( http://developer.android.com/reference/android/graphics/Typeface.htmlドキュメントを参照) 。

2)英語からギリシャ語へのオンラインUnicodeコンバーターまたはGoogle翻訳者を取得し、単語をstrings.xmlにコピーします

于 2013-09-04T13:13:47.903 に答える