Android Keyboard hides EditText

前端 未结 8 540
独厮守ぢ
独厮守ぢ 2020-11-29 04:58

When I try to write something in an EditText which is at the bottom of the screen, the soft keyboard hides the EditText. How can I resolve this issue? Below is my xml code.

8条回答
  •  日久生厌
    2020-11-29 05:43

    Use the below code where:

    InputMethodManager ipmm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                    ipmm.hideSoftInputFromWindow(url.getWindowToken(), 0);
    

    where url in my code is:

    url = (EditText) findViewById(R.id.eT_webbrowser);
    

    or Try this:

    InputMethodManager ipmm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                        ipmm.hideSoftInputFromWindow(null, 0);
    

    As another option try this: This always hides the soft input mode such that your EditText is visible

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    

提交回复
热议问题