當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。