机器人绘制的9补丁工具:什么是数字以外的黑线的意义 [英] Android Draw 9-patch tool: What is the meaning of black lines outside the figure

查看:222
本文介绍了机器人绘制的9补丁工具:什么是数字以外的黑线的意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过,足以发现谷歌和放大器;这个的android问题。还做了几次试验和放大器;错误,但无法得到这个问题。 我正在学习Android的画九补丁的图像。一个基本的,我知道的是,无论你的图像处理必须是.png格式(如果它已经在.9.png那么它会通过工具被忽略)。然而,

I tried enough to find in google & android this question. Also did several trials & errors, but couldn't get this question. I was learning Android's "Draw Nine Patch" images. One basic I know is that, whatever image you process must be in .png format (if it's already in .9.png then it will be ignored by tool). However,

  1. 在我不明白它的字面意思是伸展补丁?
  2. 什么时候你画的PNG图片外黑点到底会发生? (preVIEW窗格中显示的变化发生,但我不清楚它是如何使这些)
  3. 当我画黑点图像的​​左/前侧它显示在preVIEW一些变化;但为什么没有当你做同样在图像的右侧/底部?
  4. 任何影响
  5. 为什么这个工具主要用于背景下,当我们试图处理图像本身?
  6. 我想修改一个简单的button.png(在Android SDK中给出)。每当我使用这个工具及放大器;画黑线,这降低了伸缩它的图像的大小,而不是!为什么呢?
  7. 什么是下面一样,秀锁,节目内容,补丁的规模等给出的选项的意义?
  1. I couldn't understand what it literally means by "stretchable patches" ?
  2. What exactly happens when you draw black dots outside the .png image ? (preview pane shows changes happening, but I am unclear on how it makes those)
  3. When I draw black dots in left/top sides of image it shows some changes in preview; but why isn't there any effect when you do the same on right/bottom side of the image ?
  4. Why this tool is used primarily for background, when we try to process on the image itself ?
  5. I am trying to modify a simple button.png (given in android sdk). Whenever I use this tool & draw black lines, it reduces the size of the image instead of 'stretching' it! Why ?
  6. What is the significance of options given below like, "show lock", "show content", "Patch scale" and so on ?

我的问这么多问题道歉,但在Android的在线文档他们没有很好地解释新手。如果有人能回答这些,将成为现成的参考所有谁搜索这个论坛的begineers。

I apologize for asking so many questions, but in Android online docs they haven't explained well for novice. If someone can answer these, it will become ready reference for all the begineers who search this forum.

推荐答案

通过拉伸补丁,你基本上是告诉Android的这行,你要重复的图像中的像素列。当你伸展一个标准形象,有两种可能:一,它是按比例缩放,但还是失去了清晰度,由于插值;二,它是不成比例缩放,并失去不仅其锐度,但它的形状为好。不成比例缩放的一个例子是如下:

By stretchable patches, you're basically telling Android which rows and columns of pixels in the image that you want to repeat. When you stretch a standard image, there are two possibilities: One, it is scaled proportionally, but still loses sharpness due to interpolation; Two, it is scaled disproportionately, and loses not only its sharpness, but its shape as well. An example of a disproportionate scaling is below:

所以黑线的目的是告诉机器人图像中的哪个区域是安全的重复。上角定义列(S),它可以伸展,而左上角定义行(S),可以伸展。底部和右上角只是定义实际的内容区域(例如,在只允许按钮放置文本),你可以保留额外的空间来填充框架。在下面的图中,可以看到,这两个黑象素在框架的外侧上的图像上定义的行,而所述一个上顶限定的一列。

So the purpose of the black lines it tell Android what areas of the image are safe to repeat. The top corner defines the column(s) that it can stretch, while the left corner defines the row(s) that can stretch. The bottom and right corners just define the actual content area (e.g. where the button is allowed to place text), you can reserve extra space to pad the frame. In the image below, you can see that the two black pixels on the outside of the frame define rows on the image, while the one on top defines a column.





和下面,这显示了一个9修补伸出到各种尺寸的结果。如果它放大到要宽,在左侧和所定义的伸缩性柱的右图像的两半被对准以新的大小的左,右,和所定义的列被重复以填充空间之间。同样的事情发生在所定义的行;如果你使用的倍数(我不相信,你可以使用超过2伸行/列),它只是垫均匀地与他们两人的空间;在这种情况下,我用它来保持梯度平分下来的​​中间。

And below, this shows the result of a 9-patched stretched out to various sizes. If it's enlarged to be wider, the halves of the image on the left and right of the defined stretchable column are aligned to the left and right of the new size, and the defined column is repeated to fill the space in between. Same thing happens with the defined rows; if you use multiples (I don't believe you can use more than 2 stretch rows/columns) it just evenly pads the space with both of them; in this case I used it to keep the gradient evenly split down the middle.

这篇关于机器人绘制的9补丁工具:什么是数字以外的黑线的意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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