Изменить цвет курсора TextInputLayout.OutlinedBox Theme.MaterialComponents - PullRequest
1 голос
/ 02 апреля 2020

В моем приложении я использую textfield.TextInputLayout и textfield.TextInputEditText в качестве входного текста вместо обычного EditText. Это мое мнение:

 <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/inputId"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/fab_margin"
        android:layout_marginEnd="@dimen/fab_margin"
        android:focusedByDefault="false"
        android:enabled="true"
        android:hint="@string/userHint"
        android:textColor="@color/letter_medium_emphasis"
        app:boxCornerRadiusBottomEnd="@dimen/OutLinedBoxCorners"
        app:boxCornerRadiusBottomStart="@dimen/OutLinedBoxCorners"
        app:boxCornerRadiusTopEnd="@dimen/OutLinedBoxCorners"
        app:boxCornerRadiusTopStart="@dimen/OutLinedBoxCorners"
        app:boxStrokeColor="@color/letter_medium_emphasis"
        app:counterEnabled="true"
        app:counterMaxLength="20"
        app:helperText="@string/rememberId"
        app:helperTextEnabled="true"
        app:hintTextColor="@color/letter_medium_emphasis"
        app:startIconDrawable="@drawable/ic_account_circle_black_24dp"
        app:startIconTint="@color/primary_dark">

        <com.google.android.material.textfield.TextInputEditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:maxLines="1"
            android:inputType="text"
            android:fontFamily="@font/poppins_medium" />

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

Все правильно, кроме одной вещи, цвета курсора и селектора текста. Я прилагаю изображение, чтобы объяснить себя лучше.

enter image description here

Я читал, и, очевидно, это то, что произошло с большим количеством людей. Курсор есть, но всегда белый.

enter image description here

Я нахожу решения, но все они применимы к типу FilledBox.Dense. Я использую OutlinedBox и ничего не работает. Лучшее решение, которое я нашел, это ЭТО

Проблема в том, что, как я уже говорил, он работает с типом FilledBox.Dense, а не с OutlinedBox.

Could кто-нибудь подскажет, как адаптировать это решение или как другим способом изменить цвет?

Я пытался адаптировать его, используя тип OutlinedBox, но безуспешно.

Заранее спасибо.

...