androidandroid-edittextmaterial-componentsandroid-textinputedittexttextinputlayout

TextInputLayout hides text


Trying to set text in com.google.android.material.textfield.TextInputLayout. But hint is alway at the upper position and hides text, what can I do do fix this

    <com.google.android.material.textfield.TextInputLayout
        android:layout_marginTop="@dimen/basic_padding_margin"
        android:theme="@style/TextInputLayoutAppearance"
        android:id="@+id/model_input_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <EditText
            android:id="@+id/model"
            android:focusableInTouchMode="false"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:inputType="text"
            android:autofillHints="@string/mark_and_model"
            android:hint="@string/mark_and_model"
            />
    </com.google.android.material.textfield.TextInputLayout>

Solution

  • Use:

    <com.google.android.material.textfield.TextInputLayout
        ...
        android:hint="@string/mark_and_model">
    
        <com.google.android.material.textfield.TextInputEditText 
         ..../>
    
    </com.google.android.material.textfield.TextInputLayout>