當前位置:編程學習大全網 - 遊戲軟體 - Android在LatinIME基礎上如何加入中文輸入法

Android在LatinIME基礎上如何加入中文輸入法

GB提供簡單的samplecode,如默認將俄語、英文、法語輸入法勾選:1.新增文件LatinImeReceiver.JAVApackagecom.android.inputmethod.latin;importandroid.content.BroadcastReceiver;importandroid.content.Context;importandroid.content.Intent;importandroid.content.SharedPreferences;importandroid.content.SharedPreferences.Editor;importandroid.preference.PreferenceManager;importandroid.provider.Settings;importandroid.util.Log;importandroid.view.inputmethod.InputMethodInfo;importandroid.view.inputmethod.InputMethodManager;//importandroid.view.inputmethod.InputMethodSubtype;importandroid.text.TextUtils;publicclassLatinImeReceiverextendsBroadcastReceiver{privatestaticfinalStringTAG=LatinImeReceiver.class.getSimpleName();@OverridepublicvoidonReceive(Contextcontext,Intentintent){Log.d("LatinImeReceiver","step1");SharedPreferencessp=context.getSharedPreferences("com.android.inputmethod.latin_preferences",Context.MODE_PRIVATE);booleanhasSet=sp.getBoolean("has_set",false);if(!hasSet){Log.d("LatinImeReceiver","step2");Editoreditor=sp.edit();Log.d("LatinImeReceiver","step3");editor.putString(LatinIME.PREF_SELECTED_LANGUAGES,"en_US,ru,fr");//默認將英語、俄語勾選,具體該怎麽寫可以參考inputlanguageselection.java中的WHITELIST_LANGUAGESeditor.putBoolean("has_set",true);Log.d("LatinImeReceiver","step4");

  • 上一篇:查看基金實時走勢和價格的軟件
  • 下一篇:王思聰淩晨酒吧蹦迪,身邊兩女上演搶位大戲,妳覺得他是渣男嗎?
  • copyright 2024編程學習大全網