Search code examples
androidnine-patch

9 patch image incorrectly streeched in xhdpi density


I have problems with a 9 patch image when displayed in XHDPI.

It seems as there were a bug in Android because when displayed in HDPI is displayed correctly:

hdpi image

but when displayed in XHDPI it makes a very strange effect (look at the middle of the tab that is semitransparent: enter image description here

It's very strange and I can't see why it'sworking this way when in XHDPI. Basically de 9 patch is a one line gradient with some transparent margin needed for the viewpager indicator:

nine patch image


Solution

  • Yoah put me in the right direction. My problem was that testing phone (Nexus 5) is not a XHDPI device, it's a XXHDPI device. And as scaling is needed to convert from XHDPI to XXHDPI what explains Yoah applies to my case also.