HEET PATEL
HEET PATEL

Reputation: 11

How to change the position of toggle button in TEXTINPUTLAYOUT?

Hey I'm working with material design dependency and having a problem that how I change the position of toggle button in TEXTINPUTLAYOUT? As seen in below image the word password is not align with password toggle button

Thanks

    <com.google.android.material.textfield.TextInputLayout
    android:id="@+id/tiet_s_pwd"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:gravity="center_vertical"
    app:boxBackgroundMode="outline"
    app:boxStrokeColor="@color/white"
    app:boxStrokeErrorColor="@color/white"
    app:boxStrokeWidth="0dp"
    app:errorEnabled="true"
    app:errorTextColor="@color/primarydark"
    app:hintEnabled="false"
    app:passwordToggleEnabled="true"
    app:passwordToggleTint="#3030"
    app:layout_constraintBottom_toBottomOf="@+id/hguide_s_12"
    app:layout_constraintEnd_toEndOf="@+id/vguide_s_4"
    app:layout_constraintStart_toStartOf="@+id/vguide_s_1"
    app:layout_constraintTop_toTopOf="@+id/hguide_s_10">


    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/transparent"
        android:hint="Password"
        android:inputType="textPassword"
        android:paddingLeft="@dimen/text"
        android:paddingRight="@dimen/text"
        android:paddingBottom="@dimen/pb"
        android:textColor="#303030"
        android:textColorHint="#50303030"
        android:textSize="@dimen/text" />
</com.google.android.material.textfield.TextInputLayout>

enter image description here

Upvotes: 1

Views: 458

Answers (1)

Sam Chen
Sam Chen

Reputation: 8847

For normal setup the toggle button will be aligned center. I think it is caused by the padding setting?

Try to remove or adjust your padding of your TextInputEditText:

android:paddingLeft="@dimen/text"
android:paddingRight="@dimen/text"
android:paddingBottom="@dimen/pb"

Upvotes: 0

Related Questions