9 patch image incorrectly streeched in xhdpi density

前端 未结 3 1493
无人共我
无人共我 2021-01-15 17:17

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:

相关标签:
3条回答
  • 2021-01-15 17:53

    I assume your image is saved under the hdpi folder and there is no image in the xhdpi folder. You can copy the image file to the xhdpi folder, or change the image to the following. When the screen is xhdpi, and the image is hdpi, before opening in it is scaled to be 50% larger, so sub-pixel stretching will do the effect you see.

    Image that prevents sub-pixel stretch errors

    0 讨论(0)
  • 2021-01-15 17:55

    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.

    0 讨论(0)
  • 2021-01-15 18:04

    try this 9-patch image:

    enter image description here

    I hope this work.

    Edit

    try this 9-patch with padding from both sides:

    enter image description here

    0 讨论(0)
提交回复
热议问题