简体   繁体   English

为什么九补丁水平缩放

[英]Why nine-patch is scaled horizontally

As an addition to my previous question , I have a image and want to place text inside the image. 除了上一个问题之外 ,我还有一个图像,并希望在图像中放置文本。 I've created a nine-patch image but it scaled incorrectly - I want to leave part of the image unchanged. 我创建了一个nine-patch图像,但缩放比例不正确-我想保留部分图像不变。

original file 原始文件

在此处输入图片说明

It's how it looks in editor 它在编辑器中的外观

在此处输入图片说明

this how it looks in preview (and in my sample app with width more than image width 这就是预览的样子(在我的示例应用中,宽度大于图片宽度)

在此处输入图片说明

So I want to scale only text part and leave the 'head' and 'fingers' unchanged. 所以我只想缩放文本部分,而保持“头部”和“手指”不变。

The upper part (black border) tells the 9 patch to stretch the "head part" too. 上部(黑色边框)告诉9贴片也拉伸“头部”。

Please consider using two pixels at the sides of the "no stretch zone". 请考虑在“无拉伸区域”的侧面使用两个像素。
Something like: . . 类似于: . . . .
This way you'd have 2 horizontally stretched areas, leaving the head unstretched. 这样,您将拥有2个水平拉伸的区域,而头部却没有拉伸。

[EDIT] [编辑]

At last, I saw you put the image, so here's my patched version, just in case. 最后,我看到您放置了图像,所以这是我的补丁版本,以防万一。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM