0

i've an edittext :

    <EditText android:id="@+id/chp"
    android:layout_width="match_parent"
    android:paddingLeft="10dp"
    android:layout_height="340dp"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="5dp"
    android:gravity="top"
    android:hint="@string/hintCommentaire"
    android:textSize="25sp"
    android:drawablePadding="10dp"
    android:drawableLeft="@drawable/ic_comment"
    android:layout_margin="5dp" />

The problem is, i've my hint at the top of the edittext, but the drawable stays in the center..

I tried with "drawableStart", but it's not working.

Someone to help me ?

EDIT : I want the text and drawable in the top(same line). (i want to keep the height of my edittext)

deveLost
  • 1,151
  • 2
  • 20
  • 47

1 Answers1

0
 <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/etMobile"
            android:hint="Mobile"
            android:fontFamily="sans-serif-normal"
            android:singleLine="true"
            android:textSize="15sp"
            android:gravity="center|start"
            android:textCursorDrawable="@null"
            android:drawableStart="@drawable/ic_profile_bio"
            android:drawablePadding="10dp"
            app:met_floatingLabel="normal"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp" />

Set this Property android:gravity="center|start" in above EditText

Punit Sharma
  • 2,951
  • 1
  • 20
  • 35
Peter
  • 1,069
  • 2
  • 13
  • 24