Search code examples
androidkeyboardedittextpreference

Keyboard cuts input field on small screen


I use standart EditTextPreference but on different Android versions it looks differently:

API 7 enter image description here

API 10 enter image description here

enter image description here

How can I achieve good view? Maybe resize keyboard or something else?


Solution

  • This helped me solve the problem:

    https://stackoverflow.com/a/8481314/1752613

    public class MyEditTextPreference extends EditTextPreference
    {
        public MyEditTextPreference(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        @Override
        protected void showDialog(Bundle bundle) {
            super.showDialog(bundle);
    
            Dialog dialog = getDialog();
            if(dialog != null) {
                Window window = dialog.getWindow();
                window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE |
                    WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
            }
        }
    }