本文整理汇总了Java中android.view.inputmethod.InputMethodManager.showSoftInput方法的典型用法代码示例。如果您正苦于以下问题:Java InputMethodManager.showSoftInput方法的具体用法?Java InputMethodManager.showSoftInput怎么用?Java InputMethodManager.showSoftInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.inputmethod.InputMethodManager
的用法示例。
在下文中一共展示了InputMethodManager.showSoftInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showKeyboard
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public void showKeyboard(View view) {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1 && view.hasFocus()) {
view.clearFocus();
}
view.requestFocus();
InputMethodManager imm = (InputMethodManager) view.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(view, 0);
}
}
示例2: showSoftKeyboard
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void showSoftKeyboard(View view) {
if (view == null) return;
view.setFocusable(true);
view.setFocusableInTouchMode(true);
if (!view.isFocused()) view.requestFocus();
InputMethodManager inputMethodManager = (InputMethodManager) view.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(view, 0);
}
示例3: showKeyboard
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void showKeyboard(final View view) {
view.requestFocus();
InputMethodManager inputManager =
(InputMethodManager) view.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(view, 0);
}
示例4: showKeyboard
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
protected void showKeyboard(boolean isShow) {
Activity activity = getActivity();
if (activity == null) {
return;
}
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm == null) {
return;
}
if (isShow) {
if (activity.getCurrentFocus() == null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
} else {
imm.showSoftInput(activity.getCurrentFocus(), 0);
}
} else {
if (activity.getCurrentFocus() != null) {
imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}
示例5: showSoftInput
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static boolean showSoftInput(Activity activity) {
View view = activity.getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
return imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
return false;
}
示例6: showKeyboard
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void showKeyboard(@NonNull View view) {
InputMethodManager imm = (InputMethodManager) VoicemeApplication.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
view.requestFocus();
}
示例7: defaultAction
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public boolean defaultAction(View view) {
TextView gameStatus = (TextView) findViewById(R.id.gameStatusView);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
EditText editText = (EditText) findViewById(R.id.editText);
TextView resultView = (TextView) findViewById(R.id.resultView);
if (currentWord != null) {
currentWord = dictionary.pickGoodStarterWord();
anagrams = dictionary.getAnagrams(currentWord);
gameStatus.setText(Html.fromHtml(String.format(START_MESSAGE, currentWord.toUpperCase(), currentWord)));
fab.setImageResource(android.R.drawable.ic_menu_help);
fab.hide();
resultView.setText("");
editText.setText("");
editText.setEnabled(true);
editText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
} else {
editText.setText(currentWord);
editText.setEnabled(false);
fab.setImageResource(android.R.drawable.ic_media_play);
currentWord = null;
resultView.append(TextUtils.join("\n", anagrams));
gameStatus.append(" Hit 'Play' to start again");
}
return true;
}
示例8: showKeyboard
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
static void showKeyboard(View view) {
if (view instanceof TextView) {
view.requestFocus();
Context c = view.getContext();
InputMethodManager i = (InputMethodManager) c.getSystemService(Context.INPUT_METHOD_SERVICE);
if (i != null) i.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
}
示例9: ShowViewQA
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public void ShowViewQA(ShowViewQACallBack showViewQACallBack){
createQAView.setVisibility(View.VISIBLE);
demoView.setVisibility(View.GONE);
focus(title);
title.setText("");
add_content.setText("");
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(title, InputMethodManager.RESULT_SHOWN);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
showViewQACallBack.ShowViewQA();
}
示例10: showSoftInput
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
* 动态显示软键盘
*
* @param edit 输入框
*/
public static void showSoftInput(EditText edit) {
edit.setFocusable(true);
edit.setFocusableInTouchMode(true);
edit.requestFocus();
InputMethodManager imm = (InputMethodManager) Utils.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm == null) return;
imm.showSoftInput(edit, 0);
}
示例11: showInputMethod
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void showInputMethod(View view) {
InputMethodManager imm = (InputMethodManager) MyApplication.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
示例12: openKeybord
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void openKeybord(Context context, EditText editText) {
InputMethodManager imm = (InputMethodManager) context.getSystemService("input_method");
imm.showSoftInput(editText, 2);
imm.toggleSoftInput(2, 1);
}
示例13: showSoftInput
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
* 显示软键盘
* */
public static void showSoftInput(View view, Context context) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
示例14: showAddFilterDialog
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
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);
}
示例15: showSoftInputKeyBoard
import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static void showSoftInputKeyBoard(Context context, View focusView) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(focusView, InputMethodManager.SHOW_FORCED);
}