Working with backgrounds
Something that makes the game look bad is the plain white background we have at the moment. While we could set a background for the activity, this is not the best solution because background images are set to scale to fit, and that cannot be changed. When using a background image it will expand to cover all the view.
Note
The attribute android:background will stretch the image to make it fit in the view.
We do not want our background image to be stretched in one dimension. We want it to scale uniformly on both axes.
This can be improved with the use of a 9-patch as the background image, but in our case we will just use an ImageView that covers all the layout with scaleType set to centerCrop. This parameter does scale the image ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access