title: How do you render text in an android layer-list xml file?
body: <p>I would like to add text to a <a href="https://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList" rel="noreferrer">layer-list</a> xml file that is used as a drawable background for a <a href="http://developer.android.com/reference/android/widget/Switch.html" rel="noreferrer">Switch element</a>. The problem is the text in the switch element changes before the background does so to sync these I thought I could just put the text into the background instead of setting <code>android:textOn</code> and <code>android:textOff</code>. Or if you know of another attribute besides <code>android:state_checked</code> that I can use that will change when the text in the Switch element does, I will accept that as an answer.</p>
  
  <p>My current layer list, which contains an icon and a background color looks like this:</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:state_checked="true"&gt;
          &lt;shape&gt;
              &lt;solid
              android:color="@color/btn_switch_electricity" /&gt;
              &lt;corners
                  android:radius="5dp" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt; 
      &lt;item android:right="10dp"&gt;
          &lt;bitmap
              android:gravity="right"
              android:src="@drawable/ic_toggle_electricity" /&gt;
      &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>So to summarize, is it possible to render some text in this layer-list?</p>
  
  <p>Thanks in advance for your <b>helpful</b> comments/answers.</p>