title: setBackgroundResource() discards my XML layout attributes
body: <p>I have a view which is used as an item in a <code>ListView</code>. In my custom adapter, I change the background of the view using <code>View.setBackgroundResource()</code> depending on the item's position in the list. (I have separate assets for the first and last items in the list.)</p>
  
  <p>This sets the correct background image as expected, but it has the nasty side-effect that  all the padding I'd set in the XML definition of the view is completely ignored.</p>
  
  <p>(If I set the background drawable in the XML, and don't try to vary it at runtime in the adapter, the padding all works fine.)</p>
  
  <p>How can I alter the background image, and retain the padding? Is this a bug?</p>
  
  <p><strong>EDIT</strong> it seems someone else has found the same problem here: <a href="https://stackoverflow.com/questions/2886140/does-change-the-background-change-the-padding-of-a-linear-layout">Does changing the background also change the padding of a LinearLayout?</a></p>