title: How to change font color of hint of TextInputLayout without changing the already set typeface?
body: <p>I am trying to change the hint color of <strong>TextInputLayout</strong> programatically, although I have found a way to change the hint color by creating different <strong>styles</strong> for different states for eg:</p>
  
  <pre><code>&lt;style name="TextInputError" parent="Widget.Design.TextInputLayout"&gt;
          &lt;item name="android:textColor"&gt;@color/errorRed&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>is set when i need to show validation error.</p>
  
  <p>But what this is doing right now is changing the color but also changing the TypeFace I have set to it as well. </p>
  
  <p>I am setting the TypeFace by creating a custom widget:-</p>
  
  <pre><code>public class CustomTextInputLayout extends TextInputLayout {
      private Typeface tf;
  
      public CustomTextInputLayout(Context context) {
          super(context);
          init(null);
      }
  
  
      private void init(AttributeSet attrs) {
          tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/gt_eesti_pro_display_regular.otf");
          if (attrs != null) {
              TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CustomTextView);
              String fontName = a.getString(R.styleable.CustomTextView_fontName);
  
              if (fontName != null) {
                  tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/" + fontName);
              }
              a.recycle();
          }
          setTypeface(tf);
      }
  }
  
  </code></pre>
  
  <p>I did try to use this method inside the CustomTextInputLayout class.</p>
  
  <pre><code>setHintTextAppearance(R.style.TextInputError);
  </code></pre>
  
  <p>But this works only initially when the views are created. When I set the style from inside the activity it not only changes the style but the font changes as well.</p>
  
  <pre><code>binding.tilEmail.setHintTextAppearance(R.style.TextInputError);
  </code></pre>
  
  <p>I have tried using fontFamily in the style attribute, but that didn't help. 
  Is there any other way to do this ?</p>