Java Code Examples for android.view.inputmethod.InputMethodManager#showSoftInput()
The following examples show how to use
android.view.inputmethod.InputMethodManager#showSoftInput() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchView.java From zhangshangwuda with Apache License 2.0 | 6 votes |
/** * We override this method to be sure and show the soft keyboard if * appropriate when the TextView has focus. */ @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); if (hasWindowFocus && mSearchView.hasFocus() && getVisibility() == VISIBLE) { InputMethodManager inputManager = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(this, 0); // If in landscape mode, then make sure that // the ime is in front of the dropdown. if (isLandscapeMode(getContext())) { ensureImeVisible(this, true); } } }
Example 2
Source File: PinEntryView.java From green_android with GNU General Public License v3.0 | 5 votes |
@Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { // Make sure this view is focused editText.requestFocus(); // Show keyboard InputMethodManager inputMethodManager = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.showSoftInput(editText, 0); return true; } return super.onTouchEvent(event); }
Example 3
Source File: BaseActivity.java From Android-IM with Apache License 2.0 | 5 votes |
/** * 显示软键盘 * @param v */ public static void ShowKeyboard(View v) { InputMethodManager imm = (InputMethodManager) v.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(v, InputMethodManager.SHOW_FORCED); }
Example 4
Source File: SearchDirectionView.java From mapwize-ui-android with MIT License | 5 votes |
public void openFromSearch() { fromEditText.requestFocus(); InputMethodManager imm =(InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(fromEditText, InputMethodManager.SHOW_IMPLICIT); listener.onDirectionFromQueryChange(""); }
Example 5
Source File: KeyboardUtils.java From Ticket-Analysis with MIT License | 5 votes |
/** * 动态显示软键盘 */ public static void showSoftInput(Context context, EditText edit) { edit.setFocusable(true); edit.setFocusableInTouchMode(true); edit.requestFocus(); InputMethodManager inputManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(edit, 0); }
Example 6
Source File: PlacePickerFragment.java From android-skeleton-project with MIT License | 5 votes |
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (searchBox != null) { InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(searchBox, InputMethodManager.SHOW_IMPLICIT); } }
Example 7
Source File: SimpleInputDialog.java From SimpleDialogFragments with Apache License 2.0 | 5 votes |
/** * Helper for opening the soft keyboard */ public void openKeyboard(){ InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.showSoftInput(mInput, InputMethodManager.SHOW_IMPLICIT); } }
Example 8
Source File: CustomListDialog.java From SimpleDialogFragments with Apache License 2.0 | 5 votes |
@Override protected void onDialogShown() { updatePosButton(); if (getArguments().getBoolean(FILTER)){ // show keyboard InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.showSoftInput(mFilterEditText, InputMethodManager.SHOW_IMPLICIT); } } }
Example 9
Source File: InputPanel.java From NIM_Android_UIKit with MIT License | 5 votes |
private void showInputMethod(EditText editTextMessage) { editTextMessage.requestFocus(); //如果已经显示,则继续操作时不需要把光标定位到最后 if (!isKeyboardShowed) { editTextMessage.setSelection(editTextMessage.getText().length()); isKeyboardShowed = true; } InputMethodManager imm = (InputMethodManager) container.activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editTextMessage, 0); container.proxy.onInputPanelExpand(); }
Example 10
Source File: SearchView.java From Libraries-for-Android-Developers with MIT License | 5 votes |
private static void showSoftInputUnchecked(View view, InputMethodManager imm, int flags) { try { Method method = imm.getClass().getMethod("showSoftInputUnchecked", int.class, ResultReceiver.class); method.setAccessible(true); method.invoke(imm, flags, null); } catch (Exception e) { //Fallback to public API which hopefully does mostly the same thing imm.showSoftInput(view, flags); } }
Example 11
Source File: FolderPresenter.java From SuperNote with GNU General Public License v3.0 | 5 votes |
public void setFoucus(View view){ // 获取 接受焦点的资格 view.setFocusable(true); // 获取 焦点可以响应点触的资格 view.setFocusableInTouchMode(true); // 请求焦点 view.requestFocus(); // 弹出键盘 InputMethodManager manager=(InputMethodManager)view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); manager.toggleSoftInput(0,0); manager.showSoftInput(view,0); }
Example 12
Source File: KeyboardHelper.java From AndroidCommons with Apache License 2.0 | 5 votes |
/** * Shows soft keyboard and requests focus for given view. */ public static void showSoftKeyboard(Context context, View view) { if (view == null) { return; } final InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); view.requestFocus(); manager.showSoftInput(view, 0); }
Example 13
Source File: KeyboardUtil.java From imsdk-android with MIT License | 5 votes |
public static void showKeyboard(final View view) { view.requestFocus(); InputMethodManager inputManager = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(view, 0); }
Example 14
Source File: SystemTool.java From Lay-s with MIT License | 5 votes |
/** * editeText获取键盘 * * @param et */ public static void getEditFocus(android.widget.EditText et) { et.setFocusableInTouchMode(true); et.requestFocus(); InputMethodManager inputManager = (InputMethodManager) et.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(et, 0); }
Example 15
Source File: DisplayUtility.java From Loop with Apache License 2.0 | 5 votes |
public static void showKeyboard(Context context, View view) { view.requestFocus(); InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } }
Example 16
Source File: DeviceUtils.java From ToolsFinal with Apache License 2.0 | 5 votes |
/** * 显示输入法 * @param context * @param view */ public static void showInputSoftFromWindowMethod(Context context,View view){ try { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(view, InputMethodManager.SHOW_FORCED); } catch (Exception e) { e.printStackTrace(); } }
Example 17
Source File: KeyboardUtils.java From ETHWallet with GNU General Public License v3.0 | 5 votes |
public static void showKeyboard(View view) { InputMethodManager inputMethodManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } }
Example 18
Source File: InputMethodUtils.java From AndroidBase with Apache License 2.0 | 4 votes |
public static boolean showSoftInput(View view) { InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); return imm.showSoftInput(view, InputMethodManager.SHOW_FORCED); }
Example 19
Source File: LogcatActivity.java From javaide with GNU General Public License v3.0 | 4 votes |
private void showAddFilterDialog(final FilterAdapter filterAdapter) { // show a popup to add a new filter text LayoutInflater inflater = getLayoutInflater(); @SuppressLint("InflateParams") final AutoCompleteTextView editText = (AutoCompleteTextView) inflater.inflate(R.layout.dialog_new_filter, null, false); // show suggestions as the user types List<String> suggestions = new ArrayList<>(mSearchSuggestionsSet); SortedFilterArrayAdapter<String> suggestionAdapter = new SortedFilterArrayAdapter<>( this, R.layout.list_item_dropdown, suggestions); editText.setAdapter(suggestionAdapter); final MaterialDialog alertDialog = new MaterialDialog.Builder(this) .title(R.string.add_filter) .positiveText(android.R.string.ok) .onPositive(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { handleNewFilterText(editText.getText().toString(), filterAdapter); dialog.dismiss(); } }) .negativeText(android.R.string.cancel) .customView(editText, true) .build(); // when 'Done' is clicked (i.e. enter button), do the same as when "OK" is clicked editText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { // dismiss soft keyboard handleNewFilterText(editText.getText().toString(), filterAdapter); alertDialog.dismiss(); return true; } return false; } }); alertDialog.show(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, 0); }
Example 20
Source File: SystemUtil.java From KeyboardView with Apache License 2.0 | 2 votes |
/** * 打开软键盘 * * @param mEditText 输入框 * @param mContext 上下文 */ public static void openKeyboard(EditText mEditText, Context mContext) { InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mEditText, InputMethodManager.RESULT_SHOWN); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); }