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.
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.
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.
Put this line in your application tag:-
android:windowSoftInputMode="stateHidden|adjustPan"
example:-
<application
android:name=".application.MyApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateHidden|adjustPan"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:supportsRtl,android:allowBackup"
tools:targetApi="n">
The solution for me was, simply, adding this to the parent layout : android:fitsSystemWindows="true"
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>
In your manifest put this in your perticular activity:
android:windowSoftInputMode="adjustPan"