title: RecyclerView view doesn't change using background_selector
body: <p>I'm Trying to toggle item background color upon item selection.</p>
  <p>I can see it's logic is working yet the background wouldn't change.
  The log prints show the selctions indeed work, yet the background not.</p>
  <p>From background_selector:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
      &lt;item android:drawable=&quot;@android:color/holo_green_light&quot; android:state_pressed=&quot;false&quot; android:state_selected=&quot;true&quot; /&gt;
      &lt;item android:drawable=&quot;@android:color/holo_purple&quot; android:state_selected=&quot;false&quot; /&gt;
  &lt;/selector&gt;
  </code></pre>
  <p>from task_row.xml:</p>
  <pre><code>&lt;androidx.cardview.widget.CardView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      app:cardCornerRadius=&quot;3dp&quot;
      app:cardElevation=&quot;3dp&quot;
      android:id=&quot;@+id/tasksCardView&quot;
      android:background=&quot;@drawable/background_selector&quot;
      app:cardUseCompatPadding=&quot;true&quot;&gt;
  </code></pre>
  <p>From Adapter code:</p>
  <pre><code>
  class MyTasksAdapter (
      val arrayList: ArrayList&lt;Task&gt;,
     
      val selectedItemsList: ArrayList&lt;Task&gt;,
      val deletedItemsList: ArrayList&lt;String&gt;) :
      RecyclerView.Adapter&lt;MyTasksAdapter.ViewHolder&gt;() {
  
      inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), View.OnClickListener {
  
          private var cardView: CardView = itemView.tasksCardView
  
          private val selectedItems = SparseBooleanArray()
          override fun onClick(view: View) {
              if (selectedItems[adapterPosition, false]) {
                  selectedItems.delete(adapterPosition)
                  cardView.isSelected = false
                  Log.d(&quot;Item selected AA&quot;, &quot;position: $position&quot;)
              }
              else {
                  selectedItems.put(adapterPosition, true)
                  view.isSelected = true
                  Log.d(&quot;Item selected BB&quot;, &quot;position: $position&quot;)
              }
          }
  
          init {
              itemView.setOnClickListener(this)
  
          }
  </code></pre>
  <p>Tried also changing cardview to view, but it didn't help either.</p>
  <pre><code>
  class MyTasksAdapter (
      val arrayList: ArrayList&lt;Task&gt;,
      val selectedItemsList: ArrayList&lt;Task&gt;,
      val deletedItemsList: ArrayList&lt;String&gt;) :
      RecyclerView.Adapter&lt;MyTasksAdapter.ViewHolder&gt;() {
  
      inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), View.OnClickListener {
  
          //private lateinit var item: ClipData.Item
          private var cardView: CardView = itemView.tasksCardView
  
          private val selectedItems = SparseBooleanArray()
          override fun onClick(view: View) {
              if (selectedItems[adapterPosition, false]) {
                  selectedItems.delete(adapterPosition)
                  view.isSelected = false
                  Log.d(&quot;Item selected AA&quot;, &quot;position: $position&quot;)
              }
              else {
                  selectedItems.put(adapterPosition, true)
                  view.isSelected = true
                  Log.d(&quot;Item selected BB&quot;, &quot;position: $position&quot;)
              }
          }
  
          init {
              itemView.setOnClickListener(this)
  
          }
  
  </code></pre>
  <p>Appreciate your kind help.</p>