title: Setting Background to Imageview
body: <p>I am creating a dynamically Imageview.</p>
  
  <pre><code>ImageView btnSend = new ImageView (this);
  </code></pre>
  
  <p>I need to put a layout that contains the states of the images, this is the xml:</p>
  
  <pre><code>&lt;? xml version = "1.0" encoding = "utf-8"?&gt;
  &lt;selector
        xmlns: android = "http://schemas.android.com/apk/res/android"&gt;
        &lt;item
             android: state_focused = "true"
             android: state_pressed = "false"
             android: drawable = "@ drawable/button_state3" /&gt;
        &lt;item
             android: state_focused = "true"
             android: state_pressed = "true"
             android: drawable = "@ drawable/button_state2" /&gt;
        &lt;item
             android: state_focused = "false"
             android: state_pressed = "true"
             android: drawable = "@ drawable/button_state2" /&gt;
        &lt;item
             android: drawable = "@ drawable/button_state1" /&gt;
  &lt;/ selector&gt;
  </code></pre>
  
  <p>I tested with setBackgroundResource property, but does not work.</p>
  
  <p>how do I assign this layout to Imageview?</p>
  
  <p>Thanks in advance.</p>