linkedin / Spyglass

A library for mentions on Android
Apache License 2.0
387 stars 128 forks source link

How To Keep Keyboard Open While Scrolling Suggestion List #121

Closed jschleppy closed 3 years ago

jschleppy commented 3 years ago

I run the sample code, and that works as expected, where the keyboard will remain open while I scroll around the suggestions list.

What I can't make sense of is why in my own app, simply touching outside of the MentionsEditText field closes the keyboard. Would anyone here happen to have any suggestions to look into regarding this behavior difference?

nhibner commented 3 years ago

It's kind of hard to give good suggestions without having more context, but for what it's worth, try setting these values on the MentionsEditText in XML:

<com.linkedin.android.spyglass.ui.MentionsEditText
        ...
        android:imeOptions="flagNoExtractUi"
        android:focusable="true"
        android:focusableInTouchMode="true"/>

The sample app uses those setting. Hopefully one of those helps!

jschleppy commented 3 years ago

@nhibner Thank you for your help. I appreciate it. It wasn't the answer for me, though I did manage to find and solve the issue.

In case others encounter this and want to know what I did: The problem for me was the project I am working out of is very large and I overlooked a call to hideSoftInputFromWindow in a base Activity class within dispatchTouchEvent for any and all EditText objects. I highly recommend others to search code base for this hideSoftInputFromWindow method and setting breakpoints, confirming for sure if any of them are hit when tapping outside of the EditText.