0

I have a relative layout which contains password edittext and a visible icon. when i tried to set Textinputlayout to my edittext view then the hint text is visible with in the relative layout.

I have tried doing,

            <android.support.design.widget.TextInputLayout
                android:id="@+id/input_layout_pwd"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                app:hintTextAppearance="@style/TextLabel"
                android:textColorHint="#ffffff"
                android:layout_below="@+id/input_layout_email"
                >

 <RelativeLayout
                android:id="@+id/password_layout"
                android:layout_width="match_parent"
                android:layout_height="45dp"
                android:layout_marginTop="4dp"
                android:gravity="center_vertical"
                >

                <TextView
                    android:id="@+id/txtPreview"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentEnd="true"
                    android:layout_marginRight="10dp"
                    android:layout_centerVertical="true"
                    android:gravity="center_vertical"
                    android:text="¿"
                    android:textColor="#548a72"
                    android:textSize="32sp"/>

                <com.hurix.bookreader.views.ClearableEditText
                    android:id="@+id/passwordEditText"
                    android:layout_width="match_parent"
                    android:layout_height="35dp"
                    android:layout_toLeftOf="@+id/txtPreview"
                    android:ems="10"
                    android:imeOptions="actionDone"
                    android:hint="@string/dialog_login_password_text"
                    android:inputType="textPassword"
                    android:maxLength="200"
                    android:paddingBottom="10dp"
                    android:layout_alignBaseline="@id/txtPreview"
                    android:paddingEnd="4dp"
                    android:paddingLeft="10dp"
                    android:paddingRight="4dp"
                    android:paddingStart="10dp"
                    android:paddingTop="10dp"
                    android:singleLine="true"
                    android:textColor="#3f515b"
                    android:textColorHint="#b5b7b6"
                    android:textSize="@dimen/login_dialog_edittext_text_size"
                    android:fontFamily="sans-serif-light"
                    android:background="@color/transparent"
                    />

            </RelativeLayout>
            </android.support.design.widget.TextInputLayout>

enter image description here

Dipali Shah
  • 3,742
  • 32
  • 47

1 Answers1

1

EditText should be direct child of TextInputLayout. You have nested TextInputLayout with other layouts. Try something like this:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <EditText
        android:layout_width="match_parent"
        android:hint="Hello"
        android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
  • I have tried it. If I give TextInputLayout directly to editview, then the hint is not appearing on the edittext instead it is displaying within the relative layout. – Seshasri Seetalam Sep 12 '16 at 09:46
  • Then Share that code please so that i can look where the issue is. :) – Dhananjay Sarsonia Sep 16 '16 at 12:25
  • I had a similar issue. Maybe you can try this link: https://stackoverflow.com/questions/41981312/android-display-textview-in-the-right-side-of-edittext-which-is-in-the-textinpu/43884289 if you want to add a textview at the end of EditText inside TextInputLayout. – Yesha May 03 '18 at 11:16