Android Keyboard hides EditText

前端 未结 8 472
独厮守ぢ
独厮守ぢ 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);
    
    0 讨论(0)
  • 2020-11-29 05:44

    For that you have to declared in your activity manifeast

             <activity
                android:name=".activityname"
                android:label="@string/app_name"
                android:windowSoftInputMode="adjustPan|adjustResize" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
    0 讨论(0)
提交回复
热议问题