title: how to change button colour programmatically using material component for Android API below 23?
body: <p>I am using material component. my normal button is like this</p>
  
  <p><a href="https://i.stack.imgur.com/049Ri.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/049Ri.png" alt="enter image description here"></a></p>
  
  <p>and I set it in style like this</p>
  
  <pre><code>&lt;style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"&gt;
  
      &lt;item name="materialButtonStyle"&gt;@style/StandardButtonStyle&lt;/item&gt;
  
  &lt;/style&gt;
  
  
  &lt;style name="StandardButtonStyle" parent="Widget.MaterialComponents.Button"&gt;
      &lt;item name="backgroundTint"&gt;@color/green&lt;/item&gt;
      &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>now I need to make my button look like the image below (but without icon in it) <strong>programmatically</strong> for my app up to API 21.</p>
  
  <p><a href="https://i.stack.imgur.com/M41qI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M41qI.png" alt="enter image description here"></a></p>
  
  <p>before using material icon, I can set it by using drawable like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"&gt;
      &lt;solid android:color="#474241"/&gt; 
      &lt;corners
              android:bottomRightRadius="10dp"
              android:bottomLeftRadius="10dp"
              android:topLeftRadius="10dp"
              android:topRightRadius="10dp"/&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>and then set it programmatically like this</p>
  
  <pre><code>button.background = ContextCompat.getDrawable(mContext,R.drawable.inactive_button)
  </code></pre>
  
  <p>but it doesn't work anymore, now I am confused.....</p>
  
  <p>I have tried to make a style like this</p>
  
  <pre><code>&lt;style name="InactiveButtonStyle" parent="Widget.MaterialComponents.Button.OutlinedButton"&gt;
      &lt;item name="android:fillColor"&gt;@color/grey_light_medium&lt;/item&gt;
      &lt;item name="android:textColor"&gt;@color/grey_dark_super&lt;/item&gt;
      &lt;item name="android:textAllCaps"&gt;false&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>and then apply it programmatically like this</p>
  
  <pre><code>button.setTextAppearance(mContext,R.style.InactiveButtonStyle)
  </code></pre>
  
  <p>but it doesn't work. <code>setTextAppearance</code> method that using context as input argument is actually deprecated, and if I use <code>setTextAppearance</code> method without context is not suitable for API 21 (minimum API 23). I don't if this is the cause that it doesn't work</p>
  
  <p>so how to change button colour programmatically using material component for Android API below 23 ?</p>