【资料图】
大家好,小琪来为大家解答以上的问题。latinum,latinime这个很多人还不知道,现在让我们一起来看看吧!
1、【GB】提供简单的samplecode。
2、如默认将俄语、英文、法语输入法勾选: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");//默认将英语、俄语勾选。
3、具体该怎么写可以参考inputlanguageselection.java中的WHITELIST_LANGUAGESeditor.putBoolean("has_set",true);Log.d("LatinImeReceiver","step4");。
本文到此分享完毕,希望对大家有所帮助。
Copyright 2015-2022 安卓网版权所有 备案号:豫ICP备2021032478号-23 联系邮箱:89 718 09@qq.com