C
C
Chesterfield252021-01-17 12:28:26
Android
Chesterfield25, 2021-01-17 12:28:26

How to remove hint in edit text when clicked?

There is a hint in the edit text field. When you click on it, it rises, but how to make it disappear when you click on it? What would it be as a placeholder in html.

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/input_layout_phone"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:maxLength="15"
        android:drawableTint="@color/colorLogoBlack"
        android:drawableRight="@drawable/ic_profile_con"
        android:textSize="16sp"
        android:id="@+id/input_phone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="phone"
        android:hint="@string/phone" />

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2021-01-17
@zagayevskiy

1) do not use TextInputLayout
2) hang listener on focus (setOnFocusChangeListener) and remove / add hint (setHint) in it depending on whether there is focus or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question