I have a ListView with items that contain an ImageView and an EditText. When I touch EditText, it gets focus, virtual keyboard appears and when suggestions appear above the keyboard, EditText loses focus (and suggestions disappear).
This happens on Android 2.3 (emulator and HTC Hero), and was reported on another non-2.3 device (probably Galaxy S with 2.2). HTC Hero wit开发者_如何学Pythonh 2.2 and 2.1 roms don't have this problem...
Any ideas how to get rid of such behavior?
EDIT:
If I override onSizeChanged of ListView without calling super.onSizeChanged, focus is not lost (but a lot of other bugs is introduced...)
https://groups.google.com/forum/?pli=1#!topic/android-developers/ciMrAhW2P7M will solve it. Solution copied here...
You need to make a change in your AndroidManifest.xml Add android:windowSoftInputMode="adjustPan" to the activity holding the listview. This will solve your problem.
<activity android:name=".EditTextListView"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan">
I think you can disable suggestions by setting TYPE_TEXT_FLAG_NO_SUGGESTIONS
精彩评论