Android soft keyboard covers EditText field
AndroidAndroid EdittextSoftkeysAndroid Problem Overview
Is there a way to make the screen scroll to allow the text field to be seen?
Android Solutions
Solution 1 - Android
I had same issues. Try following code:
android:windowSoftInputMode="adjustPan"
add it to your manifest.xml in the activity tag of the activity that holds the input. example:
<activity
android:name=".Activities.InputsActivity"
...
android:windowSoftInputMode="adjustPan"
/>
Solution 2 - Android
Are you asking how to control what is visible when the soft keyboard opens? You might want to play with the windowSoftInputMode. See developer docs for more discussion.
Solution 3 - Android
I had the same issue where the softkeyboard was on top of the EditText views which were placed on the bottom of the screen. I was able to find a solution by adding a single line to my AndroidManifest.xml file's relevant activity.
android:windowSoftInputMode="adjustResize|stateHidden"
This is how the whole activity tag looks like:
<activity
android:name="com.my.MainActivity"
android:screenOrientation="portrait"
android:label="@string/title_activity_main"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
Here the most important value is the adjustResize. This will shift the whole UI up to give room for the softkeyboard.
Solution 4 - Android
Why not try to add a ScrollView to wrap whatever it is you want to scroll. Here is how I have done it, where I actually leave a header on top which does not scroll, while the dialog widgets (in particular the EditTexts) scroll when you open soft keypad.
<LinearLayout android:id="@+id/HeaderLayout" >
<!-- Here add a header or whatever will not be scrolled. -->
</LinearLayout>
<ScrollView android:id="@+id/MainForm" >
<!-- Here add your edittexts or whatever will scroll. -->
</ScrollView>
I would typically have a LinearLayout inside the ScrollView, but that is up to you. Also, setting Scrollbar style to outsideInset helps, at least on my devices.
Solution 5 - Android
All you need to do is
android:isScrollContainer="true"
source: http://www.davidwparker.com/2011/08/25/android-fixing-window-resize-and-scrolling/
Solution 6 - Android
Sorry for reviving an old thread but no one mentioned setting android:imeOptions="flagNoFullscreen"
in your EditText element
Solution 7 - Android
android:windowSoftInputMode="adjustPan"
android:isScrollContainer="true"
works for android EditText, while it not works for webview or xwalkview. When soft keyboard hide the input in webview or xwalkview you have use android:windowSoftInputMode="adjustResize"
Solution 8 - Android
I believe that you can make it scroll by using the trackball, which might be achieved programmatically through selection methods eventually, but it's just an idea. I know that the trackball method typically works, but as for the exact way to do this and make it work from code, I do not sure.
Hope that helps.
Solution 9 - Android
add this single line to your relative activity where key board cover edit text.inside onCreat()method of activity.
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Solution 10 - Android
just add
android:gravity="bottom" android:paddingBottom="10dp"
change paddingBottom according to your size of edittext
Solution 11 - Android
I know this is old but none of the above solutions worked for me. After extensive debugging, I figured out the issue.
The solution is setting the android:windowTranslucentStatus
attribute to false in my styles.xml
Solution 12 - Android
If EditText Field is been covered by the KeyBoard Use the following code:
EditText= findViewById(R.id.edittext)
EditText?.getParent()?.requestChildFocus(EditText,EditText)
If you want the Cursor to be in the Focused EditText than use EditText.requestFocus()
after the EditText?.getParent()?.requestChildFocus(EditText,EditText)
which helps to get the focus and Cursor in the Focused EditText.
Solution 13 - Android
The above solution work perfectly but if you are using Fullscreen activity(translucent status bar) then these solutions might not work. so for fullscreen use this code inside your onCreate function on your Activity.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN , WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN );
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.TYPE_STATUS_BAR);
}
Example:
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN , WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN );
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.TYPE_STATUS_BAR);
}
super.onCreate(savedInstanceState);
Solution 14 - Android
Edit your AndroidManifest.xml
android:windowSoftInputMode="adjustResize"
Add this to your root view of Layout file.
android:fitsSystemWindows="true"
That's all.
Solution 15 - Android
I had the same issue and searching the people said to add adjustPan
, while in my case adjustResize
worked.
<activity
android:name=".YOUR.ACTIVITY"
...
android:windowSoftInputMode="adjustResize"
/>