简体   繁体   中英

How I can add padding in EditText password?

Here is my code I'm trying to have the same padding from both inputs 12dp but the password don't get it, I can't find the way to do it.

 <TextView
    android:id="@+id/user_email_login_text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<EditText
    android:id="@+id/login_user_email"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="11dp"
    android:ems="10"
    android:gravity="start"
    android:imeOptions="actionNext"
    android:inputType="textEmailAddress"
    android:paddingStart="12dp"
    android:textAlignment="textStart"
    tools:ignore="RtlHardcoded,SpUsage" />


<android.support.design.widget.TextInputLayout
    android:id="@+id/input_layout_login_user_password"
    android:layout_width="match_parent"
    android:clipToPadding="true"
    android:layout_marginTop="20dp"
    android:layout_height="54dp"
    android:gravity="bottom"
    android:paddingTop="4dp">

    <EditText
        android:id="@+id/login_user_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingStart="12dp"
        android:ems="10"
        android:paddingHorizontal="10dp"
        android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>

I didn't find any example where it's done.

Thanks,

You may just want to specify the left and right padding.

<android.support.design.widget.TextInputLayout
        android:id="@+id/textLabel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginTop="8dp"
        android:padding="10dp"
        android:background="@drawable/edit_text_style"
        android:visibility="visible">

        <EditText
            android:id="@+id/input_email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@null"
            android:hint="Email"
            android:inputType="textEmailAddress"
            android:padding="10dp" />
    </android.support.design.widget.TextInputLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM