2

I have problem with padding in StateListDrawable. If for some in my styles i define reference on some <selector> with image resources, it set some wrong padding for my 9path images. By the way i set particular image - all is ok. But otherwise, android create StateListDrawable for my <selector> and (as i saw by using debugger on sources) it get padding by use method:

Rect getConstantPadding();

and return wrong values (in my case it not null or 0). This method use mVariablePadding variable:

if (mVariablePadding) {
     return null;
}

But i can't set it false in resources (maybe i did something wrong).

Does someone know solution for this problem? Thanks!

4

1 回答 1

0

问题出在 9 路径图像中。对于选择器,它从九路径可绘制对象的右下边框(内容)计算填充。在选择器旁边还有变量android:variablePadding,用于计算填充(选择最大的,等等)。所以它仍然可以是非 0,即使在大多数情况下图像没有填充。

于 2014-04-04T14:46:59.963 回答