Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextInputLayout hint padding not working

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>
like image 631
Aks4125 Avatar asked Feb 09 '23 18:02

Aks4125


1 Answers

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 :)

like image 75
pRaNaY Avatar answered Feb 11 '23 14:02

pRaNaY