user2235899
user2235899

Reputation: 133

Android Scaling down Images

i have some large resolution images that I need to scale to fit every screen as a background, the images are size of 1800x2880 and I need them to scale down to every screeen without any stretching(they are illustrations). What is the best approach?

Upvotes: 0

Views: 416

Answers (2)

Budius
Budius

Reputation: 39836

The best approach is to read the android developer guide regarding supporting multiple screen sizes and do exactly as they say there.

Anything else someone might answer you here will be simplification or copy or re-written with his own words of what said there.

edit:

regarding stretching the images you have two possible approaches:

  • create a 9-patch with your background so it can fill-in the last pixel (or fill in key areas of the image that can/should be filled in without changing the general aspect of it (it will depends on the content of the image)
  • mark the imageView to use CENTER_INSIDE

Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).

Upvotes: 1

Nitesh Khosla
Nitesh Khosla

Reputation: 875

Image set on the xhdpi folder.In the XML you will be use fillparent.it will not be stretch.

Upvotes: 0

Related Questions