Set Image on Left side of EditText in Android
Instead of using android:drawableLeft="@drawable/name_icon_edittext"
, create separateImageView
for the name_icon
.
This way you have more control on placing it on the layout
Note: I am assuming your layout
is RelativeLayout
You can use android:drawablePadding="10dp"
property in the xml file.
There's no need to create separate imagview for the icon.
if you want to add some space between you text and image then use'drawablePadding' property in xml
android:drawablePadding="10dp"
here is complete example how to use in edittext in xml file
<EditText
android:id="@+id/edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_left"
android:drawablePadding="10dp" />