0

I am implementing a text editor (not using TextView or EditText components) and when a word is misspelled I would like to bring up a popup similar to what TextViews have after you tap on the word. Is this UI the TextView brings up available in the android framework to use or will I have to create my own custom UI for this?

I can't seem to find anything after searching through the documentation. All I can find is a spell checker framework which just tells you if a word is misspelled and gives you an array of suggestions. Is there something in the input method service that might provide this UI?

Edit: I also need the "Add To Dictionary" option in the context menu so the user can add new words to the user dictionary. Similar to how TextView does it.

case12
  • 125
  • 9
  • autocompletetextview with a custom filter. – njzk2 Dec 08 '14 at 16:05
  • But that's still a TextView. Not using the android TextView classes to display text at all in my app. – case12 Dec 08 '14 at 16:35
  • it seems that all you have to do is show an alert with you array of word. I don't know what specific ui component you would be expecting. – njzk2 Dec 08 '14 at 16:37
  • I thought there may have been something in the input method framework that handles this. I wanted the exact component TextView uses. An alert dialog I think is only modal(?) and makes the entire screen behind it darker so I lose context to the word that is being referenced. The UI needs to be positioned so I can see the word. I'm guessing I will have to create my own ListPopupWindow for this. – case12 Dec 08 '14 at 16:49
  • I assume you read http://developer.android.com/guide/topics/text/creating-input-method.html#IMEAPI already? – njzk2 Dec 08 '14 at 16:52
  • Yes, looked through it. Nothing stood out when looking at the various classes there. – case12 Dec 08 '14 at 16:59
  • apparently you are supposed to provided the `candidates` view. And there is an example – njzk2 Dec 08 '14 at 17:02
  • Saw that, but that candidates view is a custom view. Thanks for checking that out though, I might use that as a base for what I want to do. – case12 Dec 09 '14 at 16:21

1 Answers1

0

I haven't implemented it myself yet, but it looks like using a ListPopupWindow will work. It also interacts with IME if you wish and anchors itself to a parent view.

case12
  • 125
  • 9