title: Unable to modify layer-list elements programatically in older APIs
body: <p>Following android code creates a <code>TextView</code> with a filled-circle background. When it is clicked a circle is created around it. If it is clicked again then the circle goes away. This works fine in API 19 but not in API 8 or 10. In those older APIs no circular boundary is drawn upon clicking. What is matter here ?</p>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:background="#ffffff" &gt;
   &lt;TextView
      android:id="@+id/col1"
      android:layout_width="50dp"
      android:layout_height="50dp"
      android:background="@drawable/circle_notapped"
     android:layout_gravity="center"
     android:layout_marginTop="50dp"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package com.kitr.sview;
  
  import android.app.Activity;
  import android.graphics.Color;
  import android.graphics.drawable.GradientDrawable;
  import android.graphics.drawable.LayerDrawable;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.TextView;
  
  public class MainActivity extends Activity  {
  
  private int select1;
  private TextView col1;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
  
  
      setContentView(R.layout.activity_main);
  
      col1 = (TextView) findViewById(R.id.col1);
  
      col1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if(select1==0)
              {
                  select1=1;
                  selectIt(v);
              }
              else
              {
                  select1=0;
                  deselectIt(v);
              }
          }
      });
  
      initializeActivity();   
  }
  
  private void initializeActivity()
  {
      LayerDrawable bgDrawable = (LayerDrawable)col1.getBackground();
      GradientDrawable shape = (GradientDrawable)         bgDrawable.findDrawableByLayerId(R.id.pat3);
      shape.setColor(0xFFF04646);
      select1=0;
  }
  
  
  
  
  private void selectIt(View v)
  {
      if(v.getId()==col1.getId())
      {
          LayerDrawable bgDrawable = (LayerDrawable)col1.getBackground();
          GradientDrawable shape = (GradientDrawable)   bgDrawable.findDrawableByLayerId(R.id.pat1);
          shape.setColor(0xFFF04646);     
  
      }
  
  }
  
  private void deselectIt(View v)
  {
      if(v.getId()==col1.getId())
      {
          LayerDrawable bgDrawable = (LayerDrawable)col1.getBackground();
          GradientDrawable shape = (GradientDrawable)   bgDrawable.findDrawableByLayerId(R.id.pat1);
  
          shape.setColor(Color.WHITE);        
      }
  
  }
  
  }
  </code></pre>
  
  <p><strong>circle_notapped.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:id="@+id/pat1" android:top="0dp" android:left="0dp" android:right="0dp" android:bottom="0dp"&gt;
  &lt;shape android:shape="oval"&gt;
      &lt;solid android:color="#FFFFFFFF" /&gt;
  &lt;/shape&gt;
  &lt;/item&gt;
  &lt;item android:id="@+id/pat2" android:top="3dp" android:left="3dp" android:right="3dp" android:bottom="3dp"&gt;
  &lt;shape android:shape="oval"&gt;
      &lt;solid android:color="#FFFFFFFF" /&gt;
  &lt;/shape&gt;
  &lt;/item&gt;
  &lt;item android:id="@+id/pat3" android:top="6dp" android:left="6dp" android:right="6dp" android:bottom="6dp"&gt;
  &lt;shape android:shape="oval"&gt;
      &lt;solid android:color="#FF27AE60" /&gt;
  &lt;/shape&gt;
  &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>