Android - creating background image
<p>I'm new to android programming and I was wondering about how to get a background image (<code>ImageView</code>) show a drawable with a correct size.</p>

<p>Let me explain well, let's imagine we have this image:</p>

<p><img src="https://timtirelli.files.wordpress.com/2011/04/campo-di-calcio.jpg" alt="background image"></p>

<p>I want this image to get shown with this aspect ratio on all screens.</p>

<p>Since I don't want the image to get stretched, I would like to set manually how my image gets shown, maybe by modifying its scale with thirdy part software.</p>

<p>the problem with this image is that, in portrait mode, it's not guaranteed to see the ball, and so I want to crop the part of my image so that the ball gets shown on the bottom-right edge.</p>

<p>I know that I have to import my drawable for all resolutions, but simply importing does not help... Any suggestions?</p>

<p><strong>EDIT:</strong></p>

<p>I'm facing this problem with dynamic background <code>ImageView</code>, so I'm not going to user <code>xml</code> layout files.</p>

<p>Using <code>scaleType</code> attribute doesn't help for this, or at least not just by setting its value.</p>