1、打開系統(tǒng)切換輸入法彈框
樣子大概就是這樣
方法如下担忧,調(diào)用 InputMethodManager
的方法即可:
try {
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).showInputMethodPicker();
} catch (Exception e) {
e.printStackTrace();
}
2芹缔、監(jiān)聽系統(tǒng)切換輸入法
監(jiān)聽系統(tǒng)的話,很容易就想到的就是監(jiān)聽系統(tǒng)的廣播了瓶盛,剛好還真有這么一個(gè)廣播 android.intent.action.INPUT_METHOD_CHANGED
private static final String INPUT_METHOD_ACTION = "android.intent.action.INPUT_METHOD_CHANGED";
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(INPUT_METHOD_ACTION);
registerReceiver(inputMethodChangeReceiver, intentFilter);
private BroadcastReceiver inputMethodChangeReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(INPUT_METHOD_ACTION)) {
//監(jiān)聽到輸入法發(fā)生改變
}
}
};