android.app.Dialog#getCurrentFocus ( )源码实例Demo

下面列出了android.app.Dialog#getCurrentFocus ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MHViewer   文件: AppHelper.java
public static void hideSoftInput(Dialog dialog) {
    View view = dialog.getCurrentFocus();
    if (view != null) {
        InputMethodManager imm = (InputMethodManager) dialog.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}
 
源代码2 项目: HappyBubble   文件: Util.java
/**
 * 隐藏软键盘
 */
public static void hide(Dialog dialog)
{
    View view = dialog.getCurrentFocus();
    if (view instanceof TextView)
    {
        InputMethodManager mInputMethodManager = (InputMethodManager) dialog.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        mInputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);
    }
}
 
源代码3 项目: HideKeyboard   文件: HideUtil.java
/**
 * Forced hidden keyboard
 *
 * @param dialog
 */
public static void hideDialogSoftKeyboard(Dialog dialog) {
    if (null == dialog) {
        throw new RuntimeException("参数错误");
    }
    View view = dialog.getCurrentFocus();
    if (null != view) {
        InputMethodManager inputMethodManager = (InputMethodManager) dialog.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    }
}
 
源代码4 项目: EhViewer   文件: AppHelper.java
public static void hideSoftInput(Dialog dialog) {
    View view = dialog.getCurrentFocus();
    if (view != null) {
        InputMethodManager imm = (InputMethodManager) dialog.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
}