4

I want to give padding to hint of edittext in TextInputLayout

where email address is hint and Sample is text

image

also tried this solution but didn't work.

facing this issue after changing support design library 23.1.0

here is my code

       <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp">

            <android.support.v7.widget.AppCompatEditText
                android:id="@+id/edtEmailAddress"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/border_round_edt_grey"
                android:focusableInTouchMode="true"
                android:hint="@string/emailadd"
                android:padding="10dp"
                android:singleLine="true" />
        </android.support.design.widget.TextInputLayout>
Community
  • 1
  • 1
Aks4125
  • 4,522
  • 4
  • 32
  • 48

1 Answers1

8

As per this answer ,if you have custom background set on EditText the android:padding attribute simple doesn't work to alter the spacing b/w the hint text and edit text .So if you have set custom background to your AppCompatEditText, you can use android:translationY attribute in the AppCompatEditText

Please add below line in your AppCompatEditText.

android:translationY="10dp" 

hope you got your answer :)

Community
  • 1
  • 1
pRaNaY
  • 24,642
  • 24
  • 96
  • 146