Ali Bdeir
Ali Bdeir

Reputation: 4375

why is drawableLeft appearing outside the EditText?

Image

Why is the icon appearing before the EditText/divider?

Here's my code:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fragment_sign_in"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
tools:context="com.*.*.*.SignInFragment">

   <!-- This is the EditText -->
  <com.rey.material.widget.EditText 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:drawableStart="@drawable/email"
    android:drawableLeft="@drawable/email"
    android:padding="0dp"
    android:hint="test"
    app:et_dividerHeight="1dp" />

</android.support.constraint.ConstraintLayout>

Upvotes: 1

Views: 332

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75798

You can use

 android:drawablePadding="5dp" // Add your own values

The padding between the drawables and the text.

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).

You can try with

 android:drawableLeft="2dp" 
 android:paddingLeft="3dp"

The drawable to be drawn to the left of the text.

Upvotes: 2

Saini
Saini

Reputation: 734

enter image description here

I used the following code for the above EditText:

<EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawableStart="@drawable/abc_ic_menu_copy_mtrl_am_alpha"
        android:drawableLeft="@drawable/abc_ic_menu_copy_mtrl_am_alpha"
    />

Upvotes: 0

Related Questions