-2

I am using ImageView With width="Match_Parent" & Height="200dp" and ScaleType="Fitxy" in my xml file,Exactly what resolutions(In pixels) should in use for MDPI,HDPI,XHDPI,XXHDPI,XXXHDPI for this particular insistance.

Thanks in advance!

1 Answers1

0

Well that depends on the base image you are using. To calculate pixles for different screen sizes use the below formula:

px = dp * (dpi / 160)

list of dpi respective to screen sizes:

ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
sumit
  • 1,047
  • 1
  • 10
  • 15
  • Hello Sumit,I have tried in this way the issue is still persisting in xxxhdpi mobiles. – Srinivasa Prudhvi Pendem Jun 01 '17 at 09:29
  • can you explain exactly what is the problem you are facing and what you are trying to achieve. – sumit Jun 01 '17 at 09:37
  • According to the formula i have used 1440*800 px image for xxxhdpi mobile but still the image was stretching . Result image- https://i.imgur.com/blIUgR0.png Actual image-https://i.imgur.com/bIzs4yS.jpg – Srinivasa Prudhvi Pendem Jun 01 '17 at 09:50
  • If you don't want your image to stretch with different screens then give the dimension in pixels. Because when you give dp android scales up and down according to different screen sizes to keep the user interaction same. – sumit Jun 01 '17 at 09:54
  • Even i dont want to miss the user interaction,With out effecting UI can we design? – Srinivasa Prudhvi Pendem Jun 01 '17 at 10:00
  • have a look at the documentation here: https://developer.android.com/guide/practices/screens_support.html – sumit Jun 01 '17 at 10:02
  • or you can use some tools to generate assets for you like: 1. Zeplin : https://zeplin.io/ 2. Android Asset Studio – sumit Jun 01 '17 at 10:20