In my application in android are many EditText fields. And I ran into a problem with hint. It is not disappearing when EditText is focused, but it disappears when I start to
My solution is like this. It shows hint when empty and not focused and hides if there is text or if it is touched
fun hideHint() {
tilFloating.isHintAnimationEnabled = false
etFloating.onFocusChangeListener = OnFocusChangeListener { v, hasFocus ->
if ((etFloating.text != null && etFloating.text.toString() != "") || hasFocus)
tilFloating.hint = ""
else
tilFloating.hint = mHint
}
}