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


Java InputMethodManager.showSoftInput方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:12,代码来源:MaterialSearchView.java

示例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);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:11,代码来源:TDevice.java

示例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);
}
 
开发者ID:qiujuer,项目名称:AirPanel,代码行数:8,代码来源:Util.java

示例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);
        }

    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:26,代码来源:TFragment.java

示例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;
}
 
开发者ID:jqjm,项目名称:Liteframework,代码行数:10,代码来源:InputMethodUtils.java

示例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();
    }
 
开发者ID:sciage,项目名称:FinalProject,代码行数:8,代码来源:ActivityUtils.java

示例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;
}
 
开发者ID:sugandha31,项目名称:Anagram,代码行数:28,代码来源:AnagramsActivity.java

示例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);
    }
}
 
开发者ID:natario1,项目名称:ViewPrinter,代码行数:9,代码来源:Utils.java

示例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();
}
 
开发者ID:MedicationReminder,项目名称:MedicationReminder,代码行数:12,代码来源:PlaceHolderFragment.java

示例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);
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:14,代码来源:KeyboardUtils.java

示例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);
}
 
开发者ID:mmjang,项目名称:quiz_helper,代码行数:5,代码来源:ViewUtil.java

示例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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:6,代码来源:KeyBoardUtils.java

示例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);
}
 
开发者ID:Sugarya,项目名称:Closet,代码行数:8,代码来源:KeyboardUtils.java

示例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);

    }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:52,代码来源:LogcatActivity.java

示例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);
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:5,代码来源:ScreenUtils.java


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