Android九补丁内容边框不被接受 [英] Android nine-patch content-border not honoured

查看:94
本文介绍了Android九补丁内容边框不被接受的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个9补丁图像.我将左上象限定义为一个内容区域,但不推荐使用(请参见屏幕快照右侧的预览).我想念什么?谢谢!

I have a 9-patch image. I defined top left quadrant to be a content area, yet it is not honoured (see the preview on the right hand side of the screenshot). What am I missing? Thanks!

推荐答案

内容区域如上所述由右栏和下栏定义,但是您真正定义的是填充(顶部,左,下和右填充).

The content region is defined by the right and lower bars as mentioned above, but what you are really defining is the padding (top,left,bottom and right padding).

通过计算右栏和下栏的开始和结束处的透明像素数来设置填充.因此,如果您的图片为100x100,则填充量约为10,10,40,40(t,l,b,r).

The padding is set by counting the number of transparent pixels at the start and end of the right and lower bars. So the padding would be approx 10,10,40,40 (t,l,b,r) if your image was 100x100.

拉伸图像时,填充不会改变,并且由于它是从每个边缘测量的,因此可以解释内容区域为何以这种方式拉伸.

这篇关于Android九补丁内容边框不被接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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