TextInputLayout隐藏文本

时间:2020-05-04 14:37:31

标签: android android-edittext material-components android-textinputedittext textinputlayout

尝试在com.google.android.material.textfield.TextInputLayout中设置文本。但是提示总是在较高位置并隐藏文本,我该怎么办

    <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>

1 个答案:

答案 0 :(得分:0)

使用:

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

    <com.google.android.material.textfield.TextInputEditText 
     ..../>

</com.google.android.material.textfield.TextInputLayout>