TextInputLayout :How to give padding or margin to hint?

后端 未结 15 1899
离开以前
离开以前 2020-11-28 06:42

I have to use TextInputLayout of design support library in my project. I want to give space between hint and EditText in TextInp

15条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 07:42

    The solution proposed by ganesh2shiv works for the most part, although I've found it also de-centres the hint text displayed inside the EditText when not focused.

    A better trick is to set the desired paddingTop to the EditText but also embed the extra padding within the EditText's background. A fairly sane way to do this is to wrap your original background in a and set the attribute to match the paddingTop of your EditText.

    
    
      
    
    

    And the bg_edit_text.xml drawable file:

    
      
         or  or whatever./>
      
    
    

提交回复
热议问题