8

I found this old post which definitely helps with my problem, but I'm noticing that it doesn't really seem to solve my problem. I have gathered that I need to set android:windowSoftInputMode="adjustPan" for my activity. But the issue is that it simply doesn't pan ENOUGH.

The text field is toward the bottom of the view, and when the keyboard shows up, the view shifts slightly but only the very top of the EditText. The text field has autocomplete turned on, and when it begins to show autocomplete options, the view pans down slightly more, but actually winds up even further obscured by the autocomplete options. It makes the text input field very difficult to use since you can't see anything you're typing.

It is a multiline input field, and when text rolls to the next line, the view pans farther, so you can actually see the previous line(s) of text. But you cannot see what you're typing, which I think is pretty important.

Does anyone have any thoughts on solving this issue?

Community
  • 1
  • 1
Matt D
  • 1,476
  • 3
  • 17
  • 26
  • So the best idea I've had is to just cause the fields above it to be "invisible" or "gone" but that's definitely not an ideal solution. Thanks for the help Phobos but unfortunately all that solution does is shrink the very field that I'm trying to retain focus in, which is not what I'm looking to do. – Matt D Jan 03 '11 at 03:29

2 Answers2

10

So, I've found what appears to be the cause of the issue. In my AndroidManifest.xml I had set

<uses-sdk android:minSdkVersion="3" />

Apparently, using a minSdkVersion below "4" was at the root of the problem. On changing it to "4", the layout appeared as it should have, and the EditText had its first line above the top of the soft keyboard appropriately.

Thanks for the help, Phobos.

Matt D
  • 1,476
  • 3
  • 17
  • 26
  • Wow, thanks for this hint! I never would have found it without it. – Shawn Lauzon Mar 08 '11 at 19:42
  • Perfect solution, exact problem I had – Dan F Jun 01 '11 at 15:44
  • 1
    I have the same problem. My Layout has 7 Edit text and top of the screen there is a button and bottom of the screen there is another button. I have used and android:windowSoftInputMode="adjustPan" in my Activity in AndroidManifest file but when the softkeyboard is opened and I try to go to the bottom button it does not let me see. My total layout is done using Relative Layout. What should I do to see the bottom button if I have opened softkey board by clicking the second edit text(want to set value in second and then want to click on bottom button). –  Jun 18 '11 at 10:40
  • I don't think it is possible to see the bottom button when using "adjustPan". From android developers regarding "adjustPan": "This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window." link [http://developer.android.com/guide/topics/manifest/activity-element.html] – Sandra Apr 18 '12 at 11:11
3

Wrap your UI in a ScrollView container. This will allow the user to see the entire UI, albeit by scrolling, if need be. The UI may not be big enough to scroll without the keyboard on screen, but when the keyboard is displayed it effectively reduces the screen size.

Phobos
  • 9,447
  • 3
  • 25
  • 30
  • I may be misunderstanding, but my entire layout.xml file is a RelativeLayout. If you're suggesting that i wrap the RelativeLayout inside of a ScrollView (i.e. ?), I tried to do that and I've had no success. It winds up looking the exact same way. It could be parameters I'm using, or something like that, but it looks identical to the way it did. If I didn't use match_parent for height/width, and fillViewPort="true", it would either cause a crash or cause the layout to appear incorrectly. Anything I'm missing? – Matt D Dec 30 '10 at 05:22
  • 1
    After wrapping your layout in ScrollView disable adjustPan. Anytime I have EditTexts in my main UI I use this approach. I find TableLayout works best for me when I am creating some kind of form UI. I dont know what your layout is, but take a look at it. If RelativeLayout doesnt work, see if you can do it with TableLayout. – Phobos Dec 30 '10 at 14:45
  • Unfortunately, the EditText field in question is not set to a specific height, so this seems not to work. The height is set to "match_parent" (to fill the 'remaining space' of the layout) and its size is based on the relative size of the View above and the View below. So what happens is if I use adjustResize instead of adjustPan, the field shrinks and nearly disappears, instead of being scrolled into the viewable area properly. – Matt D Dec 30 '10 at 22:49