Disable/Remove floating label hint text in TextInputLayout XML

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

    I've tried all of answers, but non of them are working now (specifically for com.google.android.material:material:1.1.0-beta01). Even if we make changes to EditText addition logic in TextInputLayout, we have empty space on top of field that blanking half of text and hint. Now I have a solution for the problem. Main thing is a padding in EditText, as mentioned in material.io:

    
    
        
    
    
    

    It allows us to implement a 'SearchView'-like view with search icon and text deletion button without any ugly "magic" with custom views

提交回复
热议问题