当前位置: 首页>>代码示例>>Java>>正文


Java InputMethodManager.isActive方法代码示例

本文整理汇总了Java中android.view.inputmethod.InputMethodManager.isActive方法的典型用法代码示例。如果您正苦于以下问题:Java InputMethodManager.isActive方法的具体用法?Java InputMethodManager.isActive怎么用?Java InputMethodManager.isActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.inputmethod.InputMethodManager的用法示例。


在下文中一共展示了InputMethodManager.isActive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: closeInputKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * 关闭软键盘
 * @param activity
 */
public static void closeInputKeyboard(Activity activity) {
    if(activity != null) {
        InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        if(inputMethodManager != null) {
            boolean active = inputMethodManager.isActive();
            if (active) {
                View currentFocus = activity.getCurrentFocus();
                if (currentFocus != null) {
                    IBinder windowToken = currentFocus.getWindowToken();
                    if (windowToken != null) {
                        inputMethodManager.hideSoftInputFromWindow(
                                windowToken,
                                InputMethodManager.HIDE_NOT_ALWAYS);
                    }
                }
            }
        }
    }
}
 
开发者ID:Sugarya,项目名称:Closet,代码行数:24,代码来源:KeyboardUtils.java

示例2: onKey

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    pressSearch = (keyCode == KeyEvent.KEYCODE_ENTER);
    if (pressSearch && listener != null) {
        /*隐藏软键盘*/
        InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm.isActive()) {
            imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
        }
        if (event.getAction() == KeyEvent.ACTION_UP) {
            pressSearch = false;
            listener.onSearchClick(v);
        }
    }
    return false;
}
 
开发者ID:6ag,项目名称:LiuAGeAndroid,代码行数:17,代码来源:SearchEditText.java

示例3: hintKbTwo

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
private void hintKbTwo() {
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive() && getCurrentFocus() != null) {
        if (getCurrentFocus().getWindowToken() != null) {
            imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:9,代码来源:MainActivity.java

示例4: hideSoftKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * 隐藏软键盘
 *
 * @param context
 * @param view
 */
public static void hideSoftKeyboard(Context context, View view) {
    if (view == null)
        return;
    InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(
            Context.INPUT_METHOD_SERVICE);
    if (inputMethodManager.isActive())
        inputMethodManager.hideSoftInputFromWindow(
                view.getWindowToken(), 0);
}
 
开发者ID:Wan7451,项目名称:mvparms,代码行数:16,代码来源:DeviceUtils.java

示例5: hideImm

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * Hide the input method like soft keyboard, etc... when they are active.
 */
private void hideImm() {
    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.hideSoftInputFromWindow(fab.getWindowToken(), 0);
    }
}
 
开发者ID:TonnyL,项目名称:Espresso,代码行数:10,代码来源:AddPackageFragment.java

示例6: hideImm

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * Hide the input method like soft keyboard, etc... when they are active.
 */
private void hideImm() {
    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.hideSoftInputFromWindow(searchView.getWindowToken(), 0);
    }
}
 
开发者ID:TonnyL,项目名称:Espresso,代码行数:10,代码来源:SearchFragment.java

示例7: HideKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void HideKeyboard(View v) {
    InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);

    }
}
 
开发者ID:zeng3234,项目名称:GrowingProject,代码行数:8,代码来源:KeyboardUtils.java

示例8: onTouchEvent

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
  final boolean ret = super.onTouchEvent(event);
  // Must be done after super.onTouchEvent()
  final InputMethodManager imm =
      ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE));
  if (imm != null && imm.isActive(this)) {
    imm.hideSoftInputFromWindow(getApplicationWindowToken(), 0);
  }
  return ret;
}
 
开发者ID:dialogs,项目名称:android-dialer,代码行数:12,代码来源:DigitsEditText.java

示例9: hideKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void hideKeyboard(View view) {
    if (view == null) {
        return;
    }
    try {
        InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (!imm.isActive()) {
            return;
        }
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:15,代码来源:AndroidUtilities.java

示例10: isKeyboardShowed

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static boolean isKeyboardShowed(View view) {
    if (view == null) {
        return false;
    }
    try {
        InputMethodManager inputManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        return inputManager.isActive(view);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
    return false;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:13,代码来源:AndroidUtilities.java

示例11: hideSoftInput

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * Hides the soft input if it is active for the input text.
 */
private void hideSoftInput() {
    InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); // FIXME? InputMethodManager.peekInstance();
    if (inputMethodManager != null && inputMethodManager.isActive(mInputText)) {
        inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
        if (mHasSelectorWheel) {
            mInputText.setVisibility(View.INVISIBLE);
        }
    }
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:13,代码来源:NumberPicker.java

示例12: hideKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * 隐藏软键盘
 * @param activity
 */
public static void hideKeyboard(Activity activity) {
    if (activity != null) {
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm.isActive()) {
            imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
        }
    }
}
 
开发者ID:zqHero,项目名称:rongyunDemo,代码行数:13,代码来源:CommonUtils.java

示例13: initViews

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public void initViews() {
    /* 隐藏软键盘 */
    InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive()) {
        View focusView = ((Activity) mContext).getCurrentFocus();
        if (focusView != null)
            imm.hideSoftInputFromWindow(focusView.getWindowToken(), 0);
    }
    mAttrs = readAttribute();// 获取主题属性
    mView = createView();
    mBg.startAnimation(createAlphaInAnimation());
    mPanel.startAnimation(createTranslationInAnimation());
}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:14,代码来源:ActionSheet.java

示例14: applyKeyboardShowHide

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
private void applyKeyboardShowHide(boolean autofocus) {
    final InputMethodManager imm = ((InputMethodManager) getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE));
    if (imm != null) {
        if(isDigit) {
            if(imm.isActive(this)) {
                imm.hideSoftInputFromWindow(getApplicationWindowToken(), 0);
            }
        }else if(autofocus) {
            imm.showSoftInput(this, 0);
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:14,代码来源:DigitsEditText.java

示例15: toggleKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * 切换键盘的显示与隐藏
 *
 * @param activity
 */
public static void toggleKeyboard(Activity activity) {
    InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (inputMethodManager.isActive()) {
        inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
    }
}
 
开发者ID:zhudongya123,项目名称:WechatChatroomHelper,代码行数:12,代码来源:BGAKeyboardUtil.java


注:本文中的android.view.inputmethod.InputMethodManager.isActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。