how can i use same image for different screen size in android?

时间:2016-08-31 12:15:39

标签: android image image-resizing

I have an app which i want to show an image inside the image view inside an activity. I use a 160 dip for image height and I want to image fit across device screen . I can use "xxxhdpi" , "xxhpi" , for different screen size but this make my application size very big. I want to support screen size like 1440*2560 with 480 dip. i should use an image size like 1440*640 and put in "xxxhdpi" drawable folder .

3 个答案:

答案 0 :(得分:0)

TRY THIS: use this https://romannurik.github.io/AndroidAssetStudio/nine-patches.html link and generator image for multiple screen

答案 1 :(得分:0)

You can put a version of your image that is big enough and fitXY it in your ImageView. This way it stretches to the ImageView size.

答案 2 :(得分:0)

If your images are simple icons you can consider using SVG images. You can convert svg images into android xml code using this link enter link description here

This way you don't have to be worry about the resolution of device.