欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android鍵盤輸入語(yǔ)言設(shè)置默認(rèn)打開myanmar緬甸語(yǔ)的步驟

 更新時(shí)間:2013年06月17日 15:56:56   作者:  
如何實(shí)現(xiàn)Android鍵盤輸入語(yǔ)言默認(rèn)打開為myanmar緬甸語(yǔ),如果要設(shè)置某種語(yǔ)言在輸入法默認(rèn)打開可按一下步驟添加文件,我這里已經(jīng)驗(yàn)證時(shí)OK的
locale是通過系統(tǒng)設(shè)置的地區(qū)和latin輸入法語(yǔ)言通過merger出來(lái)的,所以在系統(tǒng)地區(qū)設(shè)置和輸入法語(yǔ)言中同時(shí)支持才可以在“輸入語(yǔ)言設(shè)置“里設(shè)置

languageList是從存儲(chǔ)latin輸入法設(shè)置的latin_preferences.xml文件里讀取出來(lái)的,上一次設(shè)置的輸入語(yǔ)言

如果要設(shè)置某種語(yǔ)言在輸入法默認(rèn)打開可按一下步驟添加文件,我這里已經(jīng)驗(yàn)證時(shí)OK的,你可以試一下。
提供簡(jiǎn)單的sample code,如默認(rèn)將緬甸語(yǔ)、英文、法語(yǔ)輸入法勾選:

1.書寫文件LatinImeReceiver.java
復(fù)制代碼 代碼如下:

package 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();
@Override
public 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,my,fr"); //默認(rèn)將英語(yǔ)、緬甸語(yǔ)勾選,具體該怎么寫可以參考inputlanguageselection.java中的WHITELIST_LANGUAGES
editor.putBoolean("has_set", true);
Log.d("LatinImeReceiver", "step4");
//editor.commit();
SharedPreferencesCompat.apply(editor);
Log.d("LatinImeReceiver", "step5");
}
}

將其放置到路徑packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin文件夾下面

2.注冊(cè)intent,在packages/inputmethods/LatinIME/java/androidManifest.xml中的最后面加入:
并增加 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />權(quán)限
復(fù)制代碼 代碼如下:

<receiver android:name="LatinImeReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

相關(guān)文章

最新評(píng)論