title: Animate layout's background color change
body: <p>I have a <code>RelativeLayout</code> to which I have set a background from <code>drawable</code>.I was able to change the background of <code>RelativeLayout</code> to another when the <code>RadioButton</code> is checked. But how do I give an animation to it when it changes?</p>
  
  <p>Code:
  activity_main.xml:</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="80dp"
      android:layout_height="50dp"
      android:gravity="center"
      android:background="@drawable/original"
      android:id="@+id/rel1"&gt;
      &lt;RadioButton
          android:id="@+id/radio"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>original.xml(drawable):</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"&gt;
      &lt;solid
          android:color="#ffffff"&gt;
      &lt;/solid&gt;
      &lt;corners
          android:radius="50dp"&gt;
      &lt;/corners&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>pressed.xml:</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"&gt;
      &lt;solid
          android:color="#2196F3"&gt;
      &lt;/solid&gt;
      &lt;corners
          android:radius="50dp"&gt;
      &lt;/corners&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>Java Class:</p>
  
  <pre><code>radio.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                      if(b){
                      relativeLayout.setBackgroundResource(R.drawable.pressed);
                  }
              }
          });
  </code></pre>