0
votes

I have a JPEG photo which I want to use to as a background for one of the screens.

I want the behaviour to be simlar to the css backgroundSize: cover property. (Play with the following tool to see what I mean: https://davidwalsh.name/demo/background-size.html)

For iPhone, this issue is fairly easy, as you can literally have several different versions of the same image depending which iPhone the app is being installed on.

For Android, this is much more difficult as they have various different aspect ratios and resolutions.

Therefore my question is, how can I specify an image that covers the entire screen.

2

2 Answers

0
votes

You can always fake this by adding the imageview inside a View and calculate the proper height/width you need to cover the screen (get the shortest side and scale it up and multiply the other side by the original ratio).

You could also use https://github.com/AndreaVitale/imageview that supports a cover mode

0
votes

For Android, My suggestion is to use 9-patch Image instead of normal image. It will stretch it self to entire Screen, if you placed image as background of Window it self as well as worked for ImageView perfectly.

Thank you.