【GB】提供简单的sample code,如默认将俄语、英文、法语输入法勾选:1.新增文件LatinImeReceiver.JAVApackage com.android.inputmethod.latin;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.content.SharedPreferences;import android.content.SharedPreferences.Editor;import android.preference.PreferenceManager;import android.provider.Settings;import android.util.Log;import android.view.inputmethod.InputMethodInfo;import android.view.inputmethod.InputMethodManager;//import android.view.inputmethod.InputMethodSubtype;import android.text.TextUtils;public class LatinImeReceiver extends BroadcastReceiver {private static final String TAG = LatinImeReceiver.class.getSimpleName();@Overridepublic void onReceive(Context context, Intent intent) {Log.d("LatinImeReceiver", "step1");SharedPreferences sp = context.getSharedPreferences("com.android.inputmethod.latin_preferences",Context.MODE_PRIVATE);boolean hasSet = sp.getBoolean("has_set", false);if (!hasSet) {Log.d("LatinImeReceiver", "step2");Editor editor = 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");
相关文章
-
默认情况下 自己电脑的管理员账号密码都是多少
2023-04-18 02:45 阅读(614) -
默认网关怎么填
2023-04-08 14:43 阅读(585) -
默认输入法中文(简体)美式键盘不见了,添加也没有,如何解决?
2023-03-13 18:50 阅读(706)