title: Changing shapes gradient startcolor in a layer list
body: <p>I use a selector list to pick a buttons background.</p>
  
  <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item
      android:state_enabled="false"
      android:drawable="@drawable/shapecopmainbutton" /&gt;
  &lt;item
      android:state_pressed="true"
      android:state_enabled="true"
      android:drawable="@drawable/shapecopmainbuttonpress" /&gt;
  &lt;item
      android:state_focused="true"
      android:state_enabled="true"
      android:drawable="@drawable/shapecopmainbutton" /&gt;
  &lt;item
      android:state_enabled="true"
      android:drawable="@drawable/shapecopmainbutton" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>my shapecopmainbutton.xlm is as follows.</p>
  
  <pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item&gt;
          &lt;shape android:shape="oval"&gt;
              &lt;size
                  android:width="@dimen/layoutwidthMaincopbutton"
                  android:height="@dimen/HeightMaincopbutton" /&gt;
              &lt;solid android:color="@color/black"/&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
      &lt;item
          android:id="@+id/gradientDrawble"
          android:left="4dp"
          android:right="1dp"
          android:top="0dp"
          android:bottom="5.5dp"
          &gt;
          &lt;shape
              android:id="@+id/gradientDrawbles"
              android:shape="ring"
              android:thickness="@dimen/thicknessMaincopbutton"
              android:innerRadius="@dimen/innerRadiusMaincopbutton"
              android:useLevel="false"&gt;
              &lt;solid android:color="@color/GradientEnd" /&gt;
  
              &lt;gradient
                  android:id="@+id/gradientDrawbleg"
                  android:type="radial"
                  android:gradientRadius="30%p"
                  android:startColor="@color/GradientCenter"
                  android:endColor="@color/GradientEnd"
                  android:centerX="0.2"
                  android:centerY="0.2"
                  /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  </code></pre>
  
  <p>I want to change the start and end color of the gradient attribute of the ring shape.</p>
  
  <p>this is what I have so far in my code:</p>
  
  <p>EDited.</p>
  
  <pre><code>StateListDrawable stateListDrawable=(StateListDrawable) ContextCompat.getDrawable(context,R
                      .drawable.copbuttonmaineffect);
              LayerDrawable layerDrawable = (LayerDrawable) stateListDrawable.getCurrent();
              int colors[] = { R.color.GradientStartl, R.color.GradientEndl };
              GradientDrawable gradientDrawable = (GradientDrawable) layerDrawable.findDrawableByLayerId(R.id.
                      gradientDrawble);
              gradientDrawable.setColors(colors);
  </code></pre>
  
  <p>I stumped here as I'm not able to figure out how to set the 'rings' start/stop color gradient attribute.</p>
  
  <p>thanks.</p>