What is the proper/right resolution for Image to be put using src in ImageView to avoid stretching or unscaled images?
3 Answers
if you are using a single color of background, u can use 9Patch images. but if you are asking about icons then you need different images for different resolutions in drawable folders like drawable-hdpi
for hdpi devices drawable-xxhdpi
for xxhdpi devices.
for more details
http://developer.android.com/training/basics/supporting-devices/screens.html

- 3,868
- 1
- 20
- 26
-
i am using it as a featured image. it takes most of the screen. My app only for tablet. My problem is for landscape and portrait, the container or the ImageView changes its height and width – Rashid Feb 05 '16 at 09:45
-
then use different images for both orientations .. or check if you can tweak with android:scaleType="---" parameter of imageview according to your need.. Can you share your image or screen for more understanding.? – Nitesh Feb 05 '16 at 09:49
-
you got the point. also im already using it. but when i test it to 7 8 9 10 inches tablet. the images is ok in some screens but the other is stretch. I want the whole image to cover the whole container so i use android:scaleType="fit" – Rashid Feb 05 '16 at 09:54
-
working in some screen sizes but when tested to other device with different screen size then the image is squeeze – Rashid Feb 05 '16 at 09:59
To understand the image size check out the following link image size (drawable-hdpi/ldpi/mdpi/xhdpi) . To avoid stretching use "android:scaleType="fitcenter/fitxy/centercrop"" for more detail check this http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

- 1
- 1

- 113
- 9
Actually it totally depends on your placeholder or your needs, rather than single image you can make different sizes of image for different dp like small,large,normal,x-large .
probably https://romannurik.github.io/AndroidAssetStudio will save your time or new Android studio 2's built in plugin.
More resource http://developer.android.com/training/basics/supporting-devices/screens.html

- 107
- 3
- 7