九补丁与矢量图形 [英] Nine-patch versus Vector graphics

查看:145
本文介绍了九补丁与矢量图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Android UI,并且不清楚为什么人们可以使用矢量图形时使用九点补丁,因为这些图形可缩放且不会降低像素.我是Android的初学者,所以我希望这里不要错过任何内容,但是构建矢量图形并使用它们似乎会更容易.您不需要特殊的编辑器来构建它们.

I am learning about Android UI and am unclear why people use nine-patch, when you could use vector graphics, because those are scalable without any pixel degradation. I am a beginner in Android, so I hope I am not missing anything here, but it seems like it would be easier to build vector graphics and use those. You would not need the special editor to build them.

有人能解释使用九补丁优于矢量的好处吗?(不仅要解释九补丁的优点,因为它已经在StackO上完成了,而是vector没有的优点).因为似乎Android建议使用9个补丁.谢谢.

Can anyone explain the advantages to using nine-patch over vector? (Don't just explain advantages of nine-patch, as that is already done on StackO., but rather the advantages that vector does not have). Because it seems like Android recommends nine-patch. Thanks.

推荐答案

在矢量图形中,当我们将其设置为任何背景时,所有侧面都是缩放或拉伸的,而在9-patch中,我们可以定义哪些侧面可以缩放或拉伸,因此在运行时只有那些我们在9-patch工具中将其设置为可缩放的侧面比例尺.

In vector graphics all side are scale or stretch when we set it to any background whereas in 9-patch we can define which sides can scale or strech so at runtime only those side scale which we set it to scale in 9-patch tool.

来自->使用9色块图像的优点是,例如,将其用作背景时,在不同的屏幕尺寸下,图像不会拉伸和散开比例.中间的补丁"将保持原样,而边界"补丁将被拉伸以适合屏幕/视图尺寸.

from this -> The advantage of using 9-patch images is that when using it as a background, for instance, the image won't stretch and loose proportions in different screen sizes. the center 'patch' will remain as is and the 'borders' patches will be stretched to fit the screen/view size.

假设您有这张图片.

和一个具有填充父级宽度的按钮.如果将此图像设置为按钮背景,它将完全缩放,并且图像变得模糊(意味着将扩展到按钮宽度),并且效果会不佳.因此,您可以使用9路径工具定义在线缩放图像的某个部分,假设宽度是否为父级.不要缩放整个图像.假设我们将其设置为t(在图像中)之后.缩放整个区域,因此t不会变得模糊.所以这将使您的按钮变得更好.希望您明白我的意思..:)

and a button with fill parent width. if you set this image to button background it will scale completely and your image gets blur (mean t will expand to button width)and it will not look good. so what 9 - path tool do that you define that online scale some part of image let say if width is fill parent. dont scale whole image . let say we set that after t (in image). scale whole area, so t will not get blur. so this will make good your button.hope you got my point..:)

在制作完图像9补丁并将其设置为按钮背景后.您的按钮看起来像这样.

after making your image 9 patch and setting to button background. your button look like this.

而不是t(在图像中).整个区域展开并填充按钮的宽度.

instead of t(in image). whole area expand and fill the buttons width.

这篇关于九补丁与矢量图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆