Search code examples
androidandroid-edittexthint

Setting Margin between Icon and Hint of EditText


I have taken an EditText as follows :

 <EditText
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:hint="This is text"
   android:drawableLeft="@drawable/search"
   android:layout_centerInParent="true"/>

What if I want to set some spaces between that drawable icon and hint of EditText ?


Solution

  • For this use the attribute drawablePadding. This adds some padding between text and image.