In manifest add this line on the particular activity tag:
android:windowSoftInputMode="adjustPan"
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>
Here is simple solution for Android EditText issue of hiding behind SoftKeypad. Use the code in AndroidManifest.xml file of the project module.
<activity
android:name="com.example.MainActivity"
android:label="@string/activity_main"
android:windowSoftInputMode="adjustResize|stateHidden" />
This code worked for me.
Inside the manifest file in activity tag add this attribute:
android:windowSoftInputMode="adjustResize|stateHidden"
There are more such values for this attribute (android:windowSoftInputMode
) which will come as recommendation list. You can check with them also.
Declare windowSoftInputMode="adjustResize" in manifest.xml file
<activity
android:name=".example"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize" />
provide scroll view to the xml layout file
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:isScrollContainer="false">
// add edittext here...
</ScrollView>
</RelativeLayout>
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);
I handled that by adding ScrollView around View with EditText inside.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
// Other views
<EditText ... />
</ScrollView>
Adding tags to Android Manifest didn't help me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With