title: android set bounds for one layer of layer drawable
body: <p>I'm trying to use a <code>LayerDrawable</code> for a custom UI widget and have one layer be drawn with different bounds than the other layers, but it doesn't seem to be working. Essentially, my code does this:</p>
  
  <pre><code>int left, top, right, bottom;
  /*... do some math ... */
  Drawable d = mDrawable.findDrawableByLayerId(R.id.some_specific_layer);
  d.setBounds(left, top, right, bottom);
  </code></pre>
  
  <p>Meanwhile, the xml looks like this:</p>
  
  <pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
  &lt;item&gt;
      &lt;shape android:shape="rectangle" &gt;
          &lt;solid android:color="#ff999999" /&gt;
      &lt;/shape&gt;
  &lt;/item&gt;
  &lt;item
      android:id="@id/some_specific_layer"
      android:drawable="@drawable/some_drawable"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>So ideally I would see some_drawable over a gray rectangle, with the amount of gray showing from behind depending on the result of the bounds computation. But I never see any of the gray layer, and it appears to be because it's bounds also are being set somehow. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here's a visual of desired versus expected result:
  <img src="https://i.stack.imgur.com/sLazQ.png" alt="enter image description here"></p>
  
  <p>The top image is what I want to achieve; the gray corresponds to the first layer and the gradient corresponds to the second layer with the predefined <code>id</code>. The actual result never shows the gray.</p>
  
  <p>Does anyone know if it's possible to set the bounds of one layer of a <code>LayerDrawable</code> without affecting other layers?</p>