Fix dividers for LinearLayout (TabWidget)

child.getTop()/child.getLeft - already contains offset for divider height/width,
so we need to subtract it, otherwise divider will be drawn behind the child.

Change-Id: Idd6e5aa4b20e84c64daaefdf393bc00fafb26c45
Signed-off-by: Vladimir Baryshnikov <vovkab@gmail.com>
This commit is contained in:
Vladimir Baryshnikov
2012-01-17 14:59:48 -08:00
parent b4cee0f871
commit 20761fcdcd

View File

@@ -307,7 +307,7 @@ public class LinearLayout extends ViewGroup {
if (child != null && child.getVisibility() != GONE) {
if (hasDividerBeforeChildAt(i)) {
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int top = child.getTop() - lp.topMargin;
final int top = child.getTop() - lp.topMargin - mDividerHeight;
drawHorizontalDivider(canvas, top);
}
}
@@ -334,7 +334,7 @@ public class LinearLayout extends ViewGroup {
if (child != null && child.getVisibility() != GONE) {
if (hasDividerBeforeChildAt(i)) {
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int left = child.getLeft() - lp.leftMargin;
final int left = child.getLeft() - lp.leftMargin - mDividerWidth;
drawVerticalDivider(canvas, left);
}
}