I have this issue when using a style as seen below:
<style name="TextInputLayoutThemeWarning" parent="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="boxStrokeErrorColor">@color/warning_color</item>
<item name="errorTextColor">@color/warning_color</item>
<item name="errorIconTint">@color/warning_color</item>
<item name="errorIconDrawable">@drawable/ic_baseline_warning_24</item>
<item name="textAppearanceCaption">@style/TextAppearanceTextInputLayout</item>
</style>
It applies to any TextInputLayout when they are in an activity however, when I use the same style on a TextInputLayout in a fragment the drawable and the tint are not applied. I have tried manually setting the Drawable and Tint programmatically and in XML code and it seems that these two attributes are ignored and set to the default values instead of the ones and I am choosing.
The theme for the activity is:
<style name="Theme.Default" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textViewStyle">@style/CondensedFont</item>
</style>
Below is a snippet from the layout of the fragment (reduced for clarity):
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clCCS1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background">
<ScrollView
android:id="@+id/svCreateCharacter"
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
android:scrollbarSize="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clInnerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilCharacterName"
style="@style/TextInputLayoutThemeWarning"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
app:boxBackgroundColor="@color/content_background"
app:errorEnabled="true"
app:errorTextAppearance="@style/TextAppearanceTextInputLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvCharacterTitle">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tietCharacterName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:textSize="12sp"
android:translationZ="4dp" />
</com.google.android.material.textfield.TextInputLayout>