0

AndroidX 中,我将 Material Design 用于TextInputLayout用于文本字段。在TextInputLayoyt中,该属性app:boxStrokeWidthFocused="2dp"非常适合 API 30 和 29,但是当我在较低的 API 上测试它时它不起作用,它在我点击框之前显示 Stroke 2dp。我该如何解决?请帮帮我。提前致谢!

我的 XML 代码:

<com.google.android.material.textfield.TextInputLayout
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="User Name"
        app:hintTextColor="@color/black"
        android:textColorHint="@color/black"
        android:focusableInTouchMode="true"
        app:boxStrokeWidth="1dp"
        app:boxStrokeWidthFocused="2dp"
        app:boxStrokeColor="@color/red">
        
        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:inputType="text"
            android:textColor="@color/black"/>
    </com.google.android.material.textfield.TextInputLayout>
4

0 回答 0