zorglub76
zorglub76

Reputation: 4942

Word suggestions make EditText lose focus

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 with 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...)

Upvotes: 1

Views: 1481

Answers (2)

Elijah
Elijah

Reputation: 8610

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">

Upvotes: 11

Heidar
Heidar

Reputation: 508

I think you can disable suggestions by setting TYPE_TEXT_FLAG_NO_SUGGESTIONS

Upvotes: 0

Related Questions