Disable/Remove floating label hint text in TextInputLayout XML

前端 未结 11 1337
一向
一向 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:20

    Starting version 23.2.0 of the Support Library you can call

    setHintEnabled(false)
    

    or putting it in your TextInputLayout xml as such :

    app:hintEnabled="false"
    

    Though the name might makes you think it removes all hints, it just removes the floating one.

    Related docs and issue: http://developer.android.com/reference/android/support/design/widget/TextInputLayout.html#setHintEnabled(boolean)

    https://code.google.com/p/android/issues/detail?id=181590

提交回复
热议问题