2

I have a ListView wich contains EditText views. When touching these EditText views, the soft key pad comes up (as desired).

When using android:windowSoftInputMode="adjustPan" the touch pad hides the bottom part of the ListView and thus possibly the EditText view in focus (just touched). I know that this can be solved by using android:windowSoftInputMode="adjustResize">. However, in this case due to resizing the EditText view loses focus.

I am now wondering whether it would be possible to both have the key pad not hide the EditText view and also have it not lose focus.

orange
  • 37
  • 1
  • 8

1 Answers1

0

Edited

Try this code

editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.setClickable(true);
editText.requestFocus();

of course the first three lines can be placed in xml layout with

android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true"

Then simply call editText.requestFoxus(); right after the key pad comes into view

Gatekeeper
  • 6,708
  • 6
  • 27
  • 37
  • i checked doing that also.I called editText.requestFocus() on focus change listener i.e when key pad opens but for no result.Is there any special event when keypad opens??/ – orange Aug 23 '12 at 19:56
  • Check this http://stackoverflow.com/questions/4312319/howto-capture-the-virtual-keyboard-show-hide-event-in-android – Gatekeeper Aug 23 '12 at 20:14
  • I SOLVED THE ISSUE BY GENERATING A DYNAMIC LIST VIEW USING LINEAR LAYOUTS. – orange Oct 09 '12 at 16:00