zoukankan      html  css  js  c++  java
  • 隐藏软键盘

    public class SoftKeyboardUtil { /** * 隐藏软键盘(只适用于Activity,不适用于Fragment) */ public static void hideSoftKeyboard(Activity activity) { View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }

    /** * 隐藏软键盘(可用于Activity,Fragment) */

    public static void hideSoftKeyboard(Context context, List<View> viewList) { if (viewList == null) return; InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); for (View v : viewList) { inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } } }

  • 相关阅读:
    idea自带的maven
    面试题汇总
    mybatis参数处理
    tips
    mybatis-config.xml
    helloWorld程序
    idea遇到的问题汇总
    PL/SQL批量执行SQL脚本文件
    Iframe跳转本地项目
    angular video播放问题
  • 原文地址:https://www.cnblogs.com/wangfeng520/p/6643978.html
Copyright © 2011-2022 走看看