android强制隐藏输入法键盘(亲测可用,欢迎留言)
16lz
2021-01-23
1.工具类源码。
package com.mobile.netutils;import android.content.Context;import android.view.View;import android.view.inputmethod.InputMethodManager;/** * Created by Administrator on 2018/8/6 0006. */public class NetHideInputUtil { /** * 强制隐藏输入法键盘 * * @param context Context * @param view EditText */ public static void hideInput(Context context, View view) { InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); }}
2.调用的时候
EditText edtName;//记得初始化NetHideInputUtil.hideInput(this, edtName);
更多相关文章
- android 输入法弹出 标题栏不被顶出去
- android webkit 初始化流程
- android 输入法弹出键盘把listview顶上去,保留顶部标题栏位置不动
- Android输入法遮挡了输入框,使用android:fitsSystemWindows="true
- Android 输入法键盘和activity页面遮挡问题解决
- Android Initialization Process ---- Android 初始化过程
- android 修改谷歌拼音输入法全屏时的高度