Soft Keyboard Overlapping with EditText Field - android

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?

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.

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.

Related

Edit text weird behavior

I have an ExpandableListView which contains a RecyclerView of a custom layout. This layout contains some views including my EditText.
My behavior is : When I click in my number EditText, the keyboard appears for about 0.5s, the whole layout is cleared with default values, then the keyboard disappears, a text EditText appears, and finally I loose focus. When I click on it one more time, the keyboard stays, but in text type. Strange thing : the problem seems to be only on devices where the whole layout overflows the screen because on 10" tablet, everything is ok (layout not cleared, and keyboard not disappearing).
According to me, when I get the focus in the EditText, the layout is re-creates , making it to be cleared.
I tried a long time to figure out what was going on, but I didn't find anything. Here is the things I tried, but didn't change anything :
android:descendantFocusability="beforeDescendants" // on all parent of the EditText
focusable="true" // On the EditText
android:windowSoftInputMode="adjustPan" // In the activity in the manifest
making all the ViewHolder attributes final
As the code is very huge for all that amount of things, I don't know what I should post to help. So don't hesitate to ask anything if it can help
Thanks!
EDIT : A Gif showing the issue https://imgur.com/a/BPue4
Try adding this line to your activity on manifest.xml:
android:configChanges="keyboardHidden|screenSize"
Opening keyboard or screen size changes may trigger to re-create your content.

Keyboard issues arising on orientation change

In my app I am using various edit text and text view and list view.
Now my problem is my keyboard appears again on orientation change. Ideally when user minimize the keyboard, it should be in minimized state when device is tilted. But it reappears. How do we handle this situation.
My other problem is one of my edit text is some what at the end of screen. When keyboard appears, it hides the edit text. so user is not able to see what he is typing. What is the ideal way to handle this.
thanks.
Solution to all problem is this line android:windowSoftInputMode="stateUnchanged|adjustResize"
"stateUnchanged" will make the state of keyboard same as it was in earlier state. Either hidden or visible.
"adjustResize" will make your edit text visible.
Hope this helps.!!!
Edit
This need to be added in android manifest file.
I had this same problem. To keep the keyboard from re-appearing on rotation when you have TextViews, you must do 2 things-
Make sure the TextView doesn't have the focus. Even after hiding the keyboard, a TextView can still be focused. Try calling
textView.clearFocus()
and you should be able to see the difference in the TextView.
Make sure there is another view before it (like a parent LinearLayout, or even just a LinearLayout with 0 width and 0 height) which has these properties-
android:focusable="true"
android:focusableInTouchMode="true"
Try adding this code in your Activities properties in the manifest
android:windowSoftInputMode="stateHidden|adjustPan"
Like
<activity
android:name=".MyActivity"
android:windowSoftInputMode="stateHidden|adjustPan" >
This should take care of both your problems
For the Second Question :
You can set your layout to ScrollView to avoid hiding of edittext on Keyboard appears.
Put your entire layout in a ScrollView.
I found the following documentation to be helpful in understanding the various flags associated with the soft keyboard:
https://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

while entering first character, soft keypad push layout up

I saw many question where programmer are facing problem when soft keypad display or disappear. But my problem seems unique. I do not face any problem at the time of display or when soft keypad goes. I face problem when user enter first character. At that time i think because of Blue preview of character on top of soft keypad it is pushing my layout little bit up. Can some one tell me how can i get rid of it ?
Sounds like you might not have adjustResize set for windowSoftInputMode in your activity declaration. Posting your layout XML and your AndroidManifest would be relevant.

Android - What is the best way to avoid hiding EditText under Soft Keyboard

I have Activity with root LinearLayout. I set some of the components weight to "1" to fill the gap. Now the problem is, Some EditText are hide under the Soft Keypad while typing. And I can't disable my keypad because, there are no hard keypad. How can I avoid such situation? Any suggestion?
You can use ScrollView to avoid this.
Normally under these situations, you can put everything that should be visible while typing, under a ScrollView this way, when keyboard pops up, Android automatically scrolls (and keeps scrolling as needed) all the content above keyboard, so that user never loses sight of the control where he/she has to type.
I found the correct solution for my problem.
Here is the helping page - http://developer.android.com/resources/articles/on-screen-inputs.html
Thanks everyone for replying.

Android Phone EditText not updating the display on the device

I've got a small Android app that I am developing and I have an EditText element which does not like to display it's contents while the keyboard is on the screeen.
For example I touch the editTextbox and it brings up the keyboard, pressing a letter, say a displays a in the textbox, but after that no new text shows up so the user is essentially typing blind from that point on.
This only happens on the device and not in the emulator. Vodafone 845 if it makes any difference.
The code I am using for the EditText is this.
<EditText
android:id="#+id/EditAddress"
android:layout_width="200px"
android:singleLine="True"
android:hint="Address or Landmark"/>
I did have a OnKeyListener and an OnClickListener, but removing them from the code makes no changes to the behaviour. The EditText is also inside of a TableLayout which is inside of another TableLayout. This is the only EditText that is behaving badly on the device. (I have not coded any others in the application. But might add some just to find out whats wrong.
EDIT: Ok, it seems to be caused if the keyboard obscures the location of the original editbox such that the view has to scroll down so the editbox will not be covered by the software keyboard. For now I can rearrange my page so the edit box is at the top. But this is a bit of a hacky solution. Anyone know what causes this and/or how to fix it.
I think you need to give it a layout_height as well. Even if it is wrap_content or the like.

Categories

Resources