简体   繁体   中英

How to set android Keyboard language

when user input edittext. I want to set soft Keyboard can't change language.

How to set it ?

thanks!

Maybe this can help you.

public class LocalizationUpdaterActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        private String[] languages = { "Inglese", "Italiano", "Francese" };
        Spinner spinner = (Spinner) findViewById(R.id.spinner1);
        spinner.setPrompt("select language");

        ArrayAdapter<string> adapter = new ArrayAdapter<string>(this,
        android.R.layout.simple_spinner_item, languages);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);

        spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            public void onItemSelected(AdapterView arg0, View arg1,
                                        int arg2, long arg3) {
                Configuration config = new Configuration();
                switch (arg2) {
                    case 0:
                        config.locale = Locale.ENGLISH;
                        break;
                    case 1:
                        config.locale = Locale.ITALIAN;
                        break;
                    case 2:
                        config.locale = Locale.FRENCH;
                        break;
                    default:
                        config.locale = Locale.ENGLISH;
                        break;
                }
                getResources().updateConfiguration(config, null);
            }

            public void onNothingSelected(AdapterView arg0) {
                // TODO Auto-generated method stub
            }
        });
    }

    public void onClick(View v){
        startActivity(new Intent(getBaseContext(), TextActivity.class));
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM