textinputlayout框在textInputItemText为空时不显示笔划

lpwwtiir  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(191)

textinputlayout框当textInputItemText为空时不显示笔划

键入一些文本后,就可以工作了

我的xml代码

<com.google.android.material.textfield.TextInputLayout
                android:id="@+id/til_login_email"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp"
                android:background="@color/transparent"
                android:hint="@string/email"
                app:boxCornerRadiusBottomStart="16dp"
                app:boxCornerRadiusTopEnd="16dp"
                app:boxStrokeColor="@color/kPrimaryDarkColor"
                app:boxStrokeErrorColor="@color/red_primary"
                app:boxStrokeWidthFocused="2dp"
                app:errorEnabled="true"
                app:helperText="example@example.com"
                app:helperTextEnabled="true"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/image_login_app_logo">

                <com.google.android.material.textfield.TextInputEditText
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:inputType="textEmailAddress"
                    android:text="@={userModel.email}" />

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

主题.xml

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.JayaMaaManakamanaDental" parent="Theme.MaterialComponents.DayNight.NoActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/kPrimaryColor</item>
        <item name="colorPrimaryVariant">@color/kPrimaryDarkColor</item>
        <item name="colorOnPrimary">@color/kPrimaryLightColor</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimary</item>
        <!-- Customize your theme here. -->
        <item name="android:textColor">@color/black</item>
        <item name="android:background">?attr/colorOnPrimary</item>
    </style>
</resources>

颜色.xml

<color name="kPrimaryColor">#147EDB</color>
    <color name="kPrimaryDarkColor">#134185</color>
    <color name="kPrimaryLightColor">#DEEEF8</color>
    <color name="kButtonColor">#D66D67</color>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题