9patch png 如何在 Android 应用程序中工作
在 9patch png 中,其四个边都有黑边,但从左到右、从上到下之间通常存在差异。为什么?这种差异有何影响?
In a 9patch png, there are black edges in its four sides, but there is usually difference between the left to right, and the up to down side. Why? How does this difference impact?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简单的答案之一是
使用九种修补工具根据您的要求绘制黑线。
One of simplest ans is
draw the black line according to your requirement using nine patch tools.
左侧和顶部用于缩放,右侧和底部用于内容。因此,左侧和顶部的黑线将缩放以适合,并且按钮的内容将位于右侧和底部的黑线“内部”。
The left and top are for scaling, and the right and bottom are for content. So the black lines on left and top will scale to fit, and the content for a button will be "inside" the black lines on the right and bottom.
这里 http://developer.android.com/guide/ topics/graphics/2d-graphics.html#nine-patch 你可以找到一个很好的解释,有图片显示黑色边框的左侧和顶部部分表示可拉伸部分,而右侧和底部则表示线条定义了可绘制区域,您可以在其中放置内容。
Here http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch you can find a very good explanation, with images to show you that the left and top part of the black border indicate a stretchable section, while the right and bottom lines define the drawable area, where you can put your content.