[英]Just open keyboard English when focus on editText
當用戶觸摸android中的editText時,我需要打開鍵盤英語。
用戶可能是多鍵盤EN,FA,AR,IT
當用戶通過以下方式專注於EditText時,可以打開鍵盤選擇器對話框
InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
imeManager.showInputMethodPicker();
嘗試下面的代碼。
在onCreate上調用此函數
public static void hideKeyboardFrom(Context context, View view) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
在EditText onTouchListener上調用此函數
public static void showKeyboard(Context context, View view) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, 0);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.