title: Change Recycler view item background color by code
body: <p>I want to change the background color of my RecyclerView item. I think I should be able to do it in  <code>onBindViewHolder</code> method but I am not able to do this. I only get bottom border color of the item changed but I want to change the full background color</p>
  
  <p>Here is what I want</p>
  
  <pre><code>public void onBindViewHolder(InstalledFontViewRecyclerAdapter.ViewHolder holder, int position) {
  
      if (//Some Condition) {
          holder.itemView.setBackgroundColor(Color.GREY);
      }
      else {
          holder.itemView.setBackgroundColor(Color.RED);
      }
  }
  </code></pre>
  
  <p>I think this should produce something like</p>
  
  <p><a href="https://i.stack.imgur.com/eiN0p.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eiN0p.png" alt="enter image description here"></a></p>
  
  <p>What I get is this</p>
  
  <p><a href="https://i.stack.imgur.com/M1cFv.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/M1cFv.jpg" alt="enter image description here"></a></p>
  
  <p>Here is my RecyclerView Fragment layout.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_height="match_parent"
      &gt;
      &lt;android.support.v7.widget.RecyclerView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"
          android:id="@+id/installed_recyclerView"
          android:paddingTop="1dp"
          &gt;&lt;/android.support.v7.widget.RecyclerView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is my item layout file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:elevation="3dp"
  android:paddingBottom="1dp"
  android:clickable="true"
  android:focusable="true"
  android:focusableInTouchMode="true"&gt;
  
  &lt;android.support.v7.widget.CardView
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:id="@+id/post_card_view"
      android:layout_gravity="center"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      card_view:cardCornerRadius="1dp"
      &gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Arial New"
              android:id="@+id/installed_font_name"
              android:textSize="16dp"
              /&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Monotype Solutions"
              android:textSize="12dp"
              android:id="@+id/installed_preview_company_name"
              /&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Preview Test"
              android:id="@+id/installed_preview_textview"
              android:textSize="30dp"
              /&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="horizontal"&gt;
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"/&gt;
              &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:paddingRight="10dp"
                  android:gravity="center"
                  android:id="@+id/installed_preview_Unnstall"&gt;
                  &lt;ImageButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:src="@drawable/ic_remove_circle_24dp"
                      android:background="@android:color/transparent"
                      android:tint="@android:color/holo_red_light"
                      /&gt;
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Uninstall"
                      android:textSize="12dp"/&gt;
              &lt;/LinearLayout&gt;
              &lt;LinearLayout
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:paddingRight="10dp"
                  android:gravity="center"
                  android:id="@+id/installed_preview_flip_layout"
                  &gt;
  
                  &lt;ImageButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:src="@drawable/ic_autorenew_24dp"
                      android:background="@android:color/transparent"
                      android:tint="@android:color/holo_blue_dark"
                      /&gt;
                  &lt;TextView
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Flip This"
                      android:textSize="12dp"/&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  
  <p></p>