当前位置:知识百答>生活百科>Android在LatinIME基础上如何加入中文输入法

Android在LatinIME基础上如何加入中文输入法

2023-12-17 03:38:09 编辑:join 浏览量:565

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");

标签:输入法,Android,LatinIME

版权声明:文章由 知识百答 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.zhshbaida.com/life/278992.html
热门文章