android:drawablePadding
is the easiest way to give padding to drawable icon but You can not give specific one side padding like paddingRight
or paddingLeft
of drawable icon.To achieve that you have to dig into it. And If you apply paddingLeft
or paddingRight
to EditText
then it will place padding to entire EditText
along with drawable icon.
<TextView android:layout_width="match_parent"
android:padding="5dp"
android:id="@+id/date"
android:gravity="center|start"
android:drawableEnd="@drawable/ic_calendar"
android:background="@drawable/edit_background"
android:hint="Not Selected"
android:drawablePadding="10dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textColor="@color/black"
android:layout_height="wrap_content"/>