Disable/Remove floating label hint text in TextInputLayout XML

前端 未结 11 1358
一向
一向 2021-01-31 06:59

This may seem counter-intuitive but is there a way to disable or remove the floating label hint in TextInputLayout? The reason I want to use TextInputLayout

11条回答
  •  星月不相逢
    2021-01-31 07:38

    myEditText.setOnFocusChangeListener { _, hasFocus ->
                if (hasFocus) textContainer.hint = null
                else myEditText.hint = getString(R.string.your_string)
            }
    

    it makes your hint gone perfectly in your textInputLayout, because if you want to make it gone with app:hintEnabled="false" that's make your textInputLayout not cool :)

提交回复
热议问题