1

I have EditText and confirmation button. When I click on the button, the text is saved and EditText is disabled. However, underscores, which highlighted suggestions, remain visible. I need suggestions, so it's not an option to remove them. How can I remove underscores on button click?

Click listener for confirmation button:

buttonSave.setOnClickListener = {
    // Hide keyboard
    val keyboard = context.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
    keyboard.hideSoftInputFromWindow(rootView.windowToken, 0)

    // Show edit button
    buttonEdit.visibility = View.VISIBLE
    // Save text
    onTextChanged(buttonSave.text.toString())
}

To be clear, the text looks like this after keyboard is hidden (except the button is missing):

example text

fdermishin
  • 3,519
  • 3
  • 24
  • 45

3 Answers3

1

add this on buttonSave.onClickListener

editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
JiratPasuksmit
  • 672
  • 7
  • 18
1

Simply remove a focus from EditText

Northern Poet
  • 1,955
  • 1
  • 12
  • 17
0
android:backgroundTint="@android:color/transparent"

for more details check this answer.

Abdulrahman
  • 301
  • 1
  • 3
  • 12
  • I'm already using it (by styling EditText). It removes the line under the entire text, but not underscores for suggestions. – fdermishin Nov 07 '17 at 08:15