12

I'm developing an application for Android 3.1. Is there a way to show (or forcing) the Android keyboard in fullscreen mode?

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
carlovv
  • 222
  • 2
  • 10
  • Just a quick clarification: Solutions mentioned in http://stackoverflow.com/questions/1109022/how-to-close-hide-the-android-soft-keyboard do not work in 3.1? – bschandramohan Jul 20 '11 at 11:39
  • im think this maybr help you http://stackoverflow.com/questions/4336762/disabling-the-fullscreen-editing-view-for-soft-keyboard-input-in-landscape http://stackoverflow.com/questions/5171236/force-dialog-input-to-require-fullscreen-ime-soft-keyboard-in-landscape – test1 Sep 08 '11 at 11:40
  • i have the same problem in my surface view :( http://stackoverflow.com/questions/36914290/android-soft-keyboard-in-a-fullscreen-surface-view – railwanderer Apr 28 '16 at 12:41

2 Answers2

1

Try:

activity.getWindow().setSoftInputMode(
                        WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

To hide, or:

activity.getWindow().setSoftInputMode(
                        WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

or:

activity.getWindow().setSoftInputMode(
                        WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

One of these should help you :)

Codeman
  • 11,457
  • 8
  • 48
  • 89
-1

here comes two util functions, hope it helps

public static void showSoftKeyboard (Context context, View view) {
        try {
            ((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE))
            .showSoftInput(view, InputMethodManager.SHOW_FORCED);
        }
        catch (Exception ex) {
            Log.w(TAG, "showSoftKeyboard->"+ex.toString());
        }
    }
    public static void hideSoftKeyboard (Context context, View view) {
        try {
            InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0);
        }
        catch (Exception ex) {
            Log.w(TAG, "hideSoftKeyboard->"+ex.toString());
        }
    }


...
Social Coding @ AspiroTV

beerstorm
  • 7,882
  • 3
  • 28
  • 41