本文整理汇总了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);
}
}
}
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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());
}
示例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);
}
}
}
示例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);
}
}