I have searched and searched for an answer to this question and everything that looked like an answer has not worked so I guess I will just ask.
I have a couple of EditText
boxes added to a ListView
that is the basis to a ListActivity
. When I set the windowSoftInputMode
to adjustPan
and click in an EditText
it works until you click on it again and then the keyboard covers it up. When I use adjustResize
it works except when the keyboard comes up the EditText
loses focus and I have to tap on it again to type.
I was trying to figure out how to catch the onResize
but that seems to be associated with the View and not the activity and I'm not entirely sure how to listen for it. I have also tried all sorts of focusable settings on the EditText
boxes and the ListView
itself (as suggested in other posts I read) that don't seem to help either.
For me a combination of the following helped me (especially number 3):
1) Add the following to the related Activity in the manifest file, this is required for your ListView to be resized to fill only the area above the softKeyboard:
2) With the below the ListView will ONLY get focus only if none of its descendants want it. The descendants (the EditText) needs to get and keep focus.
3) The automatic showing/hiding of the Spelling Suggestions bar right above the keyboard keeps triggering the ListView to refresh. I turned the Suggestions off for any EditText in my ListView.
Hi below link may help for you http://mylearnandroid.blogspot.in/2014/06/listview-problem-while-scrolling.html
Have you tried after you do
adjustResize
making sure to reset the focus to theEditText
by doing something likeEditText.requestFocus();
so that it has focus again and the user doesn't have to tap it again. you can useEditText.isFocused()
to see if it is focused (true) or not (false) in a debugging log statement or something as well.you might need to set the field to
focusable
as well usingSetFocusable()
but be careful because this could potentially take away the focus from theListView
itself and prevent you from being able to scroll or select things later so you will have to play around with the setting focusable and is focused stuff.recycler view works best and no need to mess around with any other properties anywhere.
All you really need to do is apply this to your ListView:
XML:
Java:
In my case it perfect worked with adding this like of code to manifest: