2

I've created a 9patch for a background area and it seems to be stretching areas I didn't mark to be stretched. I have it so that vertically it should stretch 1 pixel from the middle, but it's still stretching the top and bottom borders. Here's my 9patch, placed in the drawable folder:

9patch

And here's the resulting image when placed as the background attribute for a layout:

screenshot

Why is it stretching the top and bottom borders? I want these to stay 2 pixels on the top and 4 pixels on the bottom, but its stretching.

You can download the image here if you want to try this out. Rename it so it has a .9.png extension, place it as the background in a View about 100dp tall, take a screenshot, then zoom in and you can see what I'm seeing.

4

1 に答える 1

10

スケーリングされています。に配置するとres/drawable、HDPIデバイスでは1.5倍、XHDPIデバイスでは2倍にスケールアップします(そこにあるドローアブルはMDPIであると想定されています)。スケーリングしないように配置するかres/drawable-nodpi、必要に応じてより大きなバージョンを作成してres/drawable-hdpi/res/drawable-xhdpiフォルダーに配置することができます。

于 2012-11-08T22:48:09.683 に答える