Is there a way to make the screen scroll to allow the text field to be seen?
15 Answers
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"
/>

- 1,376
- 3
- 17
- 35

- 3,172
- 1
- 18
- 17
-
14Simplest answer! Just as a note, this needs to be added in the Manifest file and under the activity that we want. – Navid Rezaei May 27 '14 at 15:51
-
6In my case, this at least doesn't mess up my html, as `adjustResize` would do, but it also covers my input fields – Rahul Dole Jun 14 '14 at 09:57
-
1@vikifor, make sure you add your edittext into scrollview. Even If you have just 3-4 fields in your layout, add all your fields into scrollview. This makes it scrollable when virtual keyboard opens. – Kuldeep Sakhiya Oct 14 '15 at 05:55
-
Works fine, but whenever I touch on the EditText view, the keyboard is redrawn. – Iqbal Feb 15 '16 at 11:19
-
This not working for me until you press any key, then text field is shown. Scrollview or LinearLayout as root view — doesn't matter. – Konstantin Konopko May 18 '16 at 16:44
-
Works but having the issue where not some of the text box is covered : / – Lion789 Jul 05 '16 at 03:38
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.

- 143,271
- 52
- 317
- 404

- 46,552
- 15
- 93
- 82
-
2This works fine, but make sure you have
- true
in your dialog style, in case you are using custom dialog style. – Dmitry Chistyakov Jan 28 '13 at 12:34 -
It seems that this does not work in landscape mode (Nexus 7), editable element stays hidden under keyboard. I tried different combinations of windowSoftInputMode. It seems that I can't set windowIsFloating because ActionBar won't support it. Or it might also have something to do with fact that my EditText is inside list view item? – Sampo Sarrala - codidact.org Apr 16 '14 at 13:53
-
-
2@Max Add `android:fitsSystemWindows="true"` to your root view to solve this. – David Passmore Nov 24 '15 at 17:38
-
1What about to pull the full layout above the keyboard when soft keyboard is available no matter what like whatsapp.... – Karue Benson Karue Jul 30 '16 at 13:53
-
@KarueBensonKarue how do you pull the layout up? Please show, I have the same issue – Geek Guy Oct 27 '18 at 15:36
-
hello all, i am using webview , inside that i am calling 1 PWA page, designed in HTML. when i am touching 1 inputtext in that PWA form then keyboard is hiding that view, what to do. – AMIT May 23 '19 at 09:05
-
Hey, I have an editText with a lot of text and the built-in scroll does not scroll till the end when the keyboard is open, can you take a look at that? – Chagai Friedlander Nov 18 '19 at 15:37
-
I opened a question for it: https://stackoverflow.com/questions/58918517/built-in-edittext-scroll-does-not-scroll-till-the-end-when-keyboard-is-showing – Chagai Friedlander Nov 18 '19 at 15:59
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.

- 3,550
- 27
- 26
-
But this may mess up your html's look if your css has mostly percentage values – Rahul Dole Jun 14 '14 at 09:56
-
Are you guessing here or did you try it? btw it should not mess up your html. I have tried with webviews. It will be shifting the whole view not individual elements. – DanKodi Jun 16 '14 at 01:33
-
1I tried it. I think it happens because my css has mostly percentage values – Rahul Dole Jun 16 '14 at 04:55
-
@DanKodi I tried `adjustResize|stateHidden` and it didn't make any difference from `adjustPan`. – IgorGanapolsky Jul 09 '15 at 16:25
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.
-
4While Mayra's answer is what everyone *should* do (and probably what Google thought everyone should do), this is what I end up doing almost every time. It's the only way to get the real control that is needed to make the display correct. Sigh. – SMBiggs Dec 04 '12 at 10:02
-
don't underestimate Scott's comment. It is true. in my case I didn't want to resize or pan my listview, but wanted to take up the editText at the end of that list. So, I have put editText in scrollView and it works as expected. – Darpan Jun 19 '15 at 08:31
All you need to do is
android:isScrollContainer="true"
source: http://www.davidwparker.com/2011/08/25/android-fixing-window-resize-and-scrolling/

- 4,539
- 5
- 33
- 55

- 445
- 7
- 12
-
1While the answer itself didn't help me much (attribute was not needed), the linked source contains the complete explanation (form should be embedded in ScrollView). Thanks! – johndodo Aug 31 '16 at 06:47
-
Likewise, nothing on the page helped me but the link showed adding the adjustResize to the activity windosSoftInputMode and that worked. – steven smith Dec 25 '17 at 20:24
Sorry for reviving an old thread but no one mentioned setting android:imeOptions="flagNoFullscreen"
in your EditText element

- 26,189
- 23
- 116
- 147

- 279
- 2
- 5
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"

- 27,015
- 29
- 156
- 295
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.

- 5,029
- 2
- 41
- 41
-
What I think I need is for a way to make the window "artificially" longer so that the view can scroll. Currently the RelativeLayout is set to android:layout_width="wrap_content" android:layout_height="wrap_content" – Alexis Jul 21 '10 at 02:33
-
I do not know of a solution then. Perhaps you might want to manually adjust the width and height values to suit your needs, by stretching them further to that which "wrap_content" is resolving to. – Luis Miguel Serrano Jul 21 '10 at 03:38
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);

- 237
- 2
- 12
just add
android:gravity="bottom" android:paddingBottom="10dp"
change paddingBottom according to your size of edittext

- 51
- 5
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

- 193
- 1
- 17
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.

- 443
- 4
- 9
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);

- 107
- 2
- 9
Edit your AndroidManifest.xml
android:windowSoftInputMode="adjustResize"
Add this to your root view of Layout file.
android:fitsSystemWindows="true"
That's all.

- 2,411
- 11
- 28
- 30
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"
/>

- 1,498
- 2
- 13
- 19

- 206
- 4
- 8
-
if happened to me, can happen to anyone else, just trying to help ;) @BabyishTank – Alessandro Pace Sep 13 '21 at 14:33