Accounting for background padding when drawing the bg. (Bug 10881814)

Change-Id: I516786c54e1b4b66a601337bd69b8f198dcee2aa
This commit is contained in:
Winson Chung committed 2013-10-08 16:07:07 -07:00
1 parent ad7db6e8dd
commit 82a9bd2c03
1 file changed
+6 -1
+6 -1
View File
@@ -1025,7 +1025,12 @@ public class CellLayout extends ViewGroup {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mBackgroundRect.set(0, 0, w, h);
// Expand the background drawing bounds by the padding baked into the background drawable
Rect padding = new Rect();
mNormalBackground.getPadding(padding);
mBackgroundRect.set(-padding.left, -padding.top, w + padding.right, h + padding.bottom);
mForegroundRect.set(mForegroundPadding, mForegroundPadding,
w - mForegroundPadding, h - mForegroundPadding);
}