天天看點

android輸入法問題

1 谷歌輸入法

android輸入法問題

  包名:com.google.android.inputmethod.latin

  屬于第三方輸入法

LatinIME軟鍵盤

OpenWnn CJK輸入法

PinyinIME GOOGLE輸入法

2 修改系統預設輸入法

打開輸入法,點選預設的輸入法:例如谷歌輸入法。然後adb remount,打開eclipse,檢視相應的資料庫,導出資料庫,檢視資料庫内容。

android輸入法問題
android輸入法問題
android輸入法問題

frameworks\base\packages\SettingsProvider\res\values\strings_add.xml

<!-- E40_Ewis input method --> 

<stringname="jsr_ewis_enabled_input_methods">com.android.inputmethod.latin/.LatinIME:com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME:com.google.android.googlequicksearchbox/com.google.android.voicesearch.ime.VoiceInputMethodService</string> 

<stringname="jsr_ewis_default_input_method">com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME</string>

frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java

loadSecureSettings()方法中:

           if (JSRConfig.J_E43_Ewis){

           loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,

                       R.string.jsr_ewis_enabled_input_methods);

           loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,

                    R.string.jsr_ewis_default_input_method);

           }

第二種方式:

在\frameworks\base\services\java\com\android\server的InputMethodManagerService.java檔案裡面buildInputMethodListLocked()方法添加以下内容:

String defaultIme =

Settings.Secure.getString(mContext.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);         

                   if(defaultIme== null){                        

                            finalResources res = mContext.getResources();                     

                            try{                    

                                     //StringmyIME =

res.getString(com.android.internal.R.string.config_default_input_method1);                                                            

                                     StringmyIME = "com.klye.ime.latin/.LatinIME";                               

                                     if(myIME!=null&&myIME.length()>0){                                        

                                               Settings.Secure.putString(mContext.getContentResolver(),                                     

                                                        Settings.Secure.DEFAULT_INPUT_METHOD,myIME);                               

                                               }                                                      

                                     }catch(Exceptione){                        

                                     }                          

                                     }       

該方法加載輸入法清單,讀取器用的輸入法,如果設定為空,加載全部輸入法,并選擇一個預設輸入法。

3 将Latinime輸入法的某“Done”字元變為“OK”

android輸入法問題

\packages\inputmethods\LatinIME

經分析,所有按鍵都是畫出來的。暫時的修改方法是:

\packages\inputmethods\LatinIME\java\src\com\android\inputmethod\keyboard\KeyboardView.java

//finalString label = key.getLabel();

//beginmodify by liting in 2016-1-28

  String keylabel = key.getLabel();

if(("Done").equals(keylabel)){

final String locale = context.getResources().getConfiguration().locale.getCountry();

if(("CZ").equals(locale)){

         keylabel = "OK";

}

}

final String label = keylabel;

 //end modify by liting in 2016-1-28

com.android.inputmethod.latin/.LatinIME:com.cootek.smartinputv5.oem/com.cootek.smartinput5.TouchPalIME:com.google.android.googlequicksearchbox/com.google.android.voicesearch.ime.VoiceInputMethodService:com.android.inputmethod.pinyin/.PinyinIME:com.klye.ime.latin/.LatinIME

com.android.inputmethod.latin/.LatinIME:com.android.inputmethod.pinyin/.PinyinIME:com.cootek.smartinputv5.oem/com.cootek.smartinput5.TouchPalIME:com.google.android.googlequicksearchbox/com.google.android.voicesearch.ime.VoiceInputMethodService