android 打开系统键盘的方法
生活随笔
收集整理的這篇文章主要介紹了
android 打开系统键盘的方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/*** 系統鍵盤的調用和隱藏* Created by Admin on 2022/8/27.*/
public class InputMethod {/*** @throws* @MethodName:closeInputMethod* @Description:關閉系統軟鍵盤*/static public void closeInputMethod(Context context, View view) {try {//獲取輸入法的服務InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);//判斷是否在激活狀態if (imm.isActive()) {//隱藏輸入法!!,imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);}} catch (Exception e) {} finally {}}/*** @throws* @MethodName:openInputMethod* @Description:打開系統軟鍵盤*/public static void openInputMethod(final EditText editText) {Timer timer = new Timer();timer.schedule(new TimerTask() {public void run() {InputMethodManager inputManager = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);inputManager.showSoftInput(editText, 0);}}, 500);}}
總結
以上是生活随笔為你收集整理的android 打开系统键盘的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c# PropertyGrid 自定义属
- 下一篇: 诺基亚HERE地图套件重返Windows