EditText in a listview?

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.


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

链接地址: http://www.djcxy.com/p/24230.html

上一篇: 键盘出现时不推送adjustPan推送Listview

下一篇: EditText在列表视图中?