Android的9补丁工具 [英] Utility of android nine patch

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

问题描述

我想知道为什么我们用九补丁?我所知道的是收缩或伸展图像,但如果我想调整图像大小不能,我们只是做了一个专门的图像编辑器,就像瘸子的例子吗?

I would like to know why do we use nine-patch ? I know is to shrink or stretch images but if I want to resize an image can't we just do it on a dedicated image editor like gimp for example ?

推荐答案

什么是9-补丁?

9补丁图像拉伸的,可重复的图像降低到它们的最小尺寸;用户绘制右侧和底部,坚实的黑色1像素的边告诉系统如何将图像中的内容。

9-Patch images are stretchable, repeatable images reduced to their smallest size; users draw a right and bottom, solid black 1 pixel border to tell the system how to place the content within the image.

的9修补是具有添加的扩展的文件名(filename.9.png),这允许机器人系统,以确定如何在图像可拉伸和扭曲,以满足特定的布局约束PNG图像。

The 9-Patch is a PNG image with an added extension to the file name (filename.9.png), which allows the Android system to determine how the image can be stretched and contorted to meet the specific layout constraints.

在Android操作系统中读取这些图像的边框,以了解如何正确地拉伸图像本身的图像,如文字和效果中的内容。

The Android operating system reads the borders of these images to understand how to properly stretch the image itself and the content within the image such as text and effects.

9补丁理论

9-Patch Theory

9补丁从覆盖创建断形象成九个经确定的区域的事实得到它的名字。每个区域都有特定的拉伸特性:

9-Patch gets its name from the fact that the overlay created breaks the image up into nine defined regions. Each region has specific stretch properties:

角部位(1,3,7,9) 这些区域是固定的,里面什么都没有他们会伸展。

Corner Regions (1, 3, 7, 9) These regions are fixed and nothing inside them will stretch.

水平边(4,6) 在这些区域中的像素将垂直拉伸必要的时候。

Horizontal Sides (4, 6) The pixels in these region will stretch vertically when necessary.

垂直侧面(2,8) 在这些区域中的像素将水平拉伸必要的时候。

Vertical Sides (2, 8) The pixels in these region will stretch horizontally when necessary.

中心(5) 在这个区域中的像素将伸展在水平和垂直两个方向上均匀。

Center (5) The pixels in this region will stretch in both horizontal and vertical directions equally.

这里是谷歌文档

这篇关于Android的9补丁工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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