1

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

HEET PATEL
  • 11
  • 2
  • 1
    Hi, welcome to StackOverflow. Without any indication what you tried and what you would expect to happen, it is very difficult to guess, what knowledge others could share to help you, except the obvious to read the docs (which is actually great advice if you haven't done soe). Consider reading [this](https://stackoverflow.com/help/how-to-ask) before asking questions. – Emil Vatai Dec 28 '20 at 04:26
  • What you tried to solve it? please consider uploading code. – Shoaib Kakal Dec 28 '20 at 05:22
  • @ShoaibKhalid This doesn't need code; what it needs is a clear explanation. HEET: Are you referring to the _password_ toggle? – Ryan M Dec 28 '20 at 05:54

1 Answers1

0

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"
Sam Chen
  • 7,597
  • 2
  • 40
  • 73