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


Java InputMethodManager.toggleSoftInputFromWindow方法代码示例

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


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

示例1: editName

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
@OnClick(R.id.editName)
protected void editName() {
    animationAtStart();
    InputMethodManager inputMethodManager =
            (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInputFromWindow(
            mGridName.getApplicationWindowToken(),
            InputMethodManager.SHOW_FORCED, 0);
    mGridName.requestFocus();
    mGridName.moveCursorToVisibleOffset();
    mGridName.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                mGridSettingPresenter.setGridName(mGridName.getText().toString());
                changeListener.nameChanged(String.valueOf(mGrid.getId()), mGridName.getText().toString());
                animationAtEnd();
                return true;
            }
            return false;
        }

    });
}
 
开发者ID:riteshakya037,项目名称:Android-Scrapper,代码行数:25,代码来源:GridSettingFragment.java

示例2: showKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * показать клавиатуру
 *
 * @param context - контекст
 * @param view    - view в фокусе, requestFocus которой запрашивается
 */
public static void showKeyboard(@Nullable Context context, @Nullable View view) {
    if (context != null) {

        if (view == null && context instanceof Activity) {
            view = ((Activity) context).getCurrentFocus();
        }

        if (view == null) {
            return;
        }

        view.requestFocus();
        InputMethodManager inputMethodManager =
                (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.toggleSoftInputFromWindow(view.getApplicationWindowToken(),
                                                     InputMethodManager.SHOW_FORCED,
                                                     0);
    }
}
 
开发者ID:interactiveservices,项目名称:utils-android,代码行数:26,代码来源:UiUtils.java

示例3: onClick

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.playPauseButton:
            InputMethodManager inputMethodManager =
                    (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.toggleSoftInputFromWindow(
                    relativeLayout.getApplicationWindowToken(),
                    InputMethodManager.SHOW_FORCED, 0);
            if (isConnected && out!=null) {
                new SendMessage().execute(Constants.PLAY);
            }
            break;
        case R.id.nextButton:
            if (isConnected && out!=null) {
                new SendMessage().execute(Constants.NEXT);
            }
            break;
        case R.id.previousButton:
            if (isConnected && out!=null) {
                new SendMessage().execute(Constants.PREVIOUS);
            }
            break;
    }
}
 
开发者ID:imRishabhGupta,项目名称:PC-Handler,代码行数:26,代码来源:MainActivity.java

示例4: showKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**显示/隐藏输入法
 * @param context
 * @param et
 * @param toGetWindowTokenView(为null时toGetWindowTokenView = et) 包含et的父View,键盘根据toGetWindowTokenView的位置来弹出/隐藏
 * @param show
 */
public static void showKeyboard(Context context, EditText et, View toGetWindowTokenView, boolean show){
	if (context == null) {
		Log.e(TAG, "showKeyboard  context == null >> return;");
		return;
	}

	InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);//imm必须与context唯一对应
	if (toGetWindowTokenView == null) {
		Log.w(TAG, "showKeyboard   toGetWindowTokenView == null");
		toGetWindowTokenView = et;
	}
	if (toGetWindowTokenView == null) {
		Log.e(TAG, "showKeyboard  toGetWindowTokenView == null && et == null  >> return;");
		return;
	}

	if (show == false) {
		imm.hideSoftInputFromWindow(toGetWindowTokenView.getWindowToken(), 0);
		if (et != null) {
			et.clearFocus();
		}
	} else {
		if (et != null) {
			et.setFocusable(true);
			et.setFocusableInTouchMode(true);
			et.requestFocus();
			imm.toggleSoftInputFromWindow(toGetWindowTokenView.getWindowToken()
					, InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
		}
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:38,代码来源:EditTextUtil.java

示例5: focusChange

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public void focusChange(View view) {
    OTPEditText editText = (OTPEditText) view;
    if (editText.getOrder() < getOtp().length() - 1) {
        setFocus();
        InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null) {
            imm.toggleSoftInputFromWindow(getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
        }
    }
}
 
开发者ID:msayan,项目名称:otp-view,代码行数:11,代码来源:OTPView.java

示例6: showKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**显示/隐藏输入法
 * @param context
 * @param et
 * @param toGetWindowTokenView(为null时toGetWindowTokenView = et) 包含et的父View,键盘根据toGetWindowTokenView的位置来弹出/隐藏
 * @param show
 */
public static void showKeyboard(Context context, EditText et, View toGetWindowTokenView, boolean show){
	if (context == null) {
		Log.e(TAG, "showKeyboard  context == null >> return;");
		return;
	}

	imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);//imm必须与context唯一对应
	if (toGetWindowTokenView == null) {
		Log.w(TAG, "showKeyboard   toGetWindowTokenView == null");
		toGetWindowTokenView = et;
	}
	if (toGetWindowTokenView == null) {
		Log.e(TAG, "showKeyboard  toGetWindowTokenView == null && et == null  >> return;");
		return;
	}

	if (show == false) {
		imm.hideSoftInputFromWindow(toGetWindowTokenView.getWindowToken(), 0);
		if (et != null) {
			et.clearFocus();
		}
	} else {
		if (et != null) {
			et.setFocusable(true);
			et.setFocusableInTouchMode(true);
			et.requestFocus();
			imm.toggleSoftInputFromWindow(toGetWindowTokenView.getWindowToken()
					, InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
		}
	}
}
 
开发者ID:TommyLemon,项目名称:APIJSON-Android-RxJava,代码行数:38,代码来源:EditTextManager.java

示例7: onOptionsItemSelected

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_filter:
            if (db.getList().size() != 0) {
                actionDrawer();
            }
            return true;
        case R.id.action_sort:
            if (getPreferences(MODE_PRIVATE).getBoolean("isAlphabeticalOrder", false)) {
                getPreferences(MODE_PRIVATE).edit().putBoolean("isAlphabeticalOrder", false).apply();
            } else {
                getPreferences(MODE_PRIVATE).edit().putBoolean("isAlphabeticalOrder", true).apply();
            }
            actionSort(true);
            return true;
        case R.id.action_changePassword:
            changePassword();
            return true;
        case R.id.action_settings:
            startActivity(new Intent(MainActivity.this, SettingsActivity.class));
            return true;
        case R.id.action_about:
            AboutToast.getInstance().createAboutToast(getPackageManager(), getPackageName(), toast0, getApplicationContext());
            return true;
        case R.id.action_search:
            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.toggleSoftInputFromWindow(listview.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
开发者ID:RyuzakiKK,项目名称:NoteCrypt,代码行数:33,代码来源:MainActivity.java

示例8: enableSoftInput

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void enableSoftInput(View view, boolean toEnable) {
    InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);
    if (toEnable) {
        imm.toggleSoftInputFromWindow(view.getWindowToken(), InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
    }
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:8,代码来源:Util.java

示例9: editSelectedTextEntity

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
private void editSelectedTextEntity() {
    if (!(currentEntityView instanceof TextPaintView) || editingText) {
        return;
    }

    curtainView.setVisibility(View.VISIBLE);

    final TextPaintView textPaintView = (TextPaintView) currentEntityView;
    initialText = textPaintView.getText();
    editingText = true;

    editedTextPosition = textPaintView.getPosition();
    editedTextRotation = textPaintView.getRotation();
    editedTextScale = textPaintView.getScale();

    textPaintView.setPosition(centerPositionForEntity());
    textPaintView.setRotation(0.0f);
    textPaintView.setScale(1.0f);

    undoItem.setVisibility(GONE);
    doneItem.setVisibility(VISIBLE);
    actionBar.setTitle(LocaleController.getString("PaintText", R.string.PaintText));
    toolsView.setVisibility(GONE);
    setColorPickerVisibilitySlide(false);

    setTextDimVisibility(true, textPaintView);
    textPaintView.beginEditing();

    InputMethodManager inputMethodManager = (InputMethodManager) ApplicationLoader.applicationContext.getSystemService(Activity.INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInputFromWindow(textPaintView.getFocusedView().getWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:32,代码来源:PhotoPaintView.java

示例10: showKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * Shows the soft keyboard
 */
public static void showKeyboard(Activity activity) {
	// Check if no view has focus:
	View view = activity.getCurrentFocus();
	if (view != null) {
		InputMethodManager inputMethodManager=(InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
		inputMethodManager.toggleSoftInputFromWindow(view.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
	}
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:12,代码来源:Service.java

示例11: openKeyBoard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * Open keyboard
 *
 * @param v with respect to this view
 */
public static void openKeyBoard(View v) {
    try {
        InputMethodManager inputMethodManager = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.toggleSoftInputFromWindow(v.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
    } catch (Throwable e) {
        //Not the end of the world. Keyborad didn't show up, that's it.
        e.printStackTrace();
    }
}
 
开发者ID:yajnesh,项目名称:AndroidGeneralUtils,代码行数:15,代码来源:ViewUtil.java

示例12: showSoftKeyboard

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void showSoftKeyboard(Context context, View view) {
  InputMethodManager inputMethodManager = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
  inputMethodManager.toggleSoftInputFromWindow(view.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}
 
开发者ID:goutfeb,项目名称:ElephantAsia,代码行数:5,代码来源:KeyboardHelpers.java


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