title: Change Chip Widget style programmatically not working - Android
body: <p>I'm doing a list with Chips. I want this chips can be selected, so, taking a look to <a href="https://material.io/develop/android/components/chip/" rel="noreferrer">https://material.io/develop/android/components/chip/</a> I see I can have a "Choice Chip".</p>
  
  <p>As I need to create and add dynamically I have to configure with specific colors, color ripplem, ...</p>
  
  <p>So what I have to configure it is:</p>
  
  <pre><code>val chip = Chip(context, null, R.style.CustomChipChoice)
              chip.isClickable = true
              chip.isCheckable = true
              chip.isCheckedIconVisible=false
              chip.height = ScreenUtils.dpToPx(40)
              chip.chipCornerRadius = (ScreenUtils.dpToPx(20)).toFloat()
              chip.chipStrokeWidth = (ScreenUtils.dpToPx(2)).toFloat()
              chip.setTextAppearanceResource(R.style.ChipTextStyle)
              return chip
  </code></pre>
  
  <p>What I try with <code>R.style.CustomChipChoice</code> is:</p>
  
  <p><strong>CustomChipChoice style</strong></p>
  
  <pre><code>&lt;style name="CustomChipChoice" parent="@style/Widget.MaterialComponents.Chip.Choice"&gt;
          &lt;item name="chipBackgroundColor"&gt;@color/background_color_chip_state_list&lt;/item&gt;
          &lt;item name="chipStrokeColor"&gt;@color/background_color_chip_state_list&lt;/item&gt;
          &lt;item name="rippleColor"&gt;@color/topic_social_pressed&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p><strong>background_color_chip_state_list</strong></p>
  
  <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:color="@color/topic_social_selected" android:state_checked="true" /&gt;
      &lt;item android:color="@color/topic_social_pressed" android:state_pressed="true" /&gt;
      &lt;item android:color="@color/topic_unselected_background" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p><strong>stroke_color_chip_state_list</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:color="@color/topic_social_pressed" android:state_checked="true"/&gt;
      &lt;item android:color="@color/grey_material2" android:state_checked="false"/&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>As you can see, I make the chip, clickable and checkable (hiding the check icon I don't need).</p>
  
  <p>But when I test it, the colors are not set. The chips just look as default colors (grey's scale)</p>
  
  <p>Where can I apply or how, this custom style?</p>
  
  <p>P.S: </p>
  
  <p>I have done a fast test, to see if my CustomStyle was malformed/etc..</p>
  
  <p>I added a view via xml and worked perfectly...</p>
  
  <pre><code>&lt;android.support.design.chip.Chip
                  android:id="@+id/test"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  style="@style/CustomChipChoice"
                  android:checkable="true"
                  android:clickable="true"
                  app:checkedIconVisible="false"
                  android:text="Chip Test"/&gt;
  </code></pre>