Android adjustpan not working after the first time

前端 未结 8 884
生来不讨喜
生来不讨喜 2020-12-01 05:55

My problem: starting from the second time the software keyboard is shown on the screen, it entirely hides my EditText.

Attribute android:windowSoftInputMode=\"adjus

8条回答
  •  [愿得一人]
    2020-12-01 06:44

    subclassed EditText and overridden the method onKeyPreIme(int keyCode, KeyEvent event) like this:

       @Override
       public boolean onKeyPreIme(int keyCode, KeyEvent event)
       {
          if(keyCode == KeyEvent.KEYCODE_BACK)
            {
                clearFocus();
            }
       return super.onKeyPreIme(keyCode, event);
       }
    

    Now when the back key is pressed, the EditText lost the focus. Then tapping it again adjustpan will work.

提交回复
热议问题