I can underlined a word in edittext box using this method:
contentText.getEditableText().setSpan(new UnderlineSpan(), position, endLen, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
After i underlined the word, is there any methods that can let me know which word is underlined?This is because I need to know how many words and what is the word that had underlined. Thanks in advance for answering my question.
You already know what word is underlined. You just underlined it. Use
positionandendLento retrieve the text that you underlined.While you can call
getSpans()later on to retrieve theUnderlineSpan, theUnderlineSpandoes not contain information about its position.