1

I have a ListView that I need to manually resize when the keyboard is displayed.

This works by overwriting the onSizeChanged method and changing the size of the view accordingly. (Thanks to this post How to set size and layout in onSizeChanged?)

However, when the size of the list view is changed the EditText that I clicked on loses its focus and I can't enter any text.

EDIT: I tried to set the focus of the EditText that had the focus before, however, this doesn't always work, although the method returns true when calling request focus

Community
  • 1
  • 1
Display name
  • 2,697
  • 2
  • 31
  • 49

2 Answers2

0

In onSizeChanged() after resizing the ListView add this line.

 editText.requestFocus();
Hassan Jawed
  • 1,650
  • 1
  • 12
  • 19
  • I don't think this works for the case where there are multiple EditText's, where an arbitrary one could be being edited at the time of the resize event (which is my problem right now)... – samus Jan 15 '13 at 20:59
0

Use edittext.requestfocus() method:

requestFocus();
Sergey K.
  • 24,894
  • 13
  • 106
  • 174
Sourabh Saldi
  • 3,567
  • 6
  • 34
  • 57