Search code examples
androidiconsmaterial-designandroid-textinputedittext

How to set Android Material-Design TextInputEditText Leading-Icon?


enter image description hereHow to set the Leading-Icon in TextInputEditText of Material Design for Android? I only found how to set the Leading-Icon.

With drawableLeft the Icon is not centered vertically. Gravity has no effect.


Solution

  • I found the solution for this problem. The Container TextInputLayout of TextInputEditText has a attribute called app:startIconDrawable where you can set the leading icon of the textfield. The attribute "drawableLeft" does not work if you use material design.

    enter image description here