Skip to content

Commit 20761fc

Browse files
committed
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>
1 parent b4cee0f commit 20761fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/java/android/widget/LinearLayout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void drawDividersVertical(Canvas canvas) {
307307
if (child != null && child.getVisibility() != GONE) {
308308
if (hasDividerBeforeChildAt(i)) {
309309
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
310-
final int top = child.getTop() - lp.topMargin;
310+
final int top = child.getTop() - lp.topMargin - mDividerHeight;
311311
drawHorizontalDivider(canvas, top);
312312
}
313313
}
@@ -334,7 +334,7 @@ void drawDividersHorizontal(Canvas canvas) {
334334
if (child != null && child.getVisibility() != GONE) {
335335
if (hasDividerBeforeChildAt(i)) {
336336
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
337-
final int left = child.getLeft() - lp.leftMargin;
337+
final int left = child.getLeft() - lp.leftMargin - mDividerWidth;
338338
drawVerticalDivider(canvas, left);
339339
}
340340
}

0 commit comments

Comments
 (0)