here is a quick description of my screen layout.
<CustomLayout>
<CardView>
<CustomTextView />
<CustomTextView />
<CustomTextView />
</CardView>
<CustomTextView />
<CustomTextView />
</CustomLayout>
I coded it so that CardView extends LinearLayout
and CustomTextView extends TextView
. Everything works fine except I want to draw a border line at the bottom of the CardView
and at the bottom of the second CustomTextView
. To do so, I use the same method for my CardView
and my CustomTextView
:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
getLocalVisibleRect(mRect);
if (mDrawBottomBorder)
canvas.drawLine(mRect.left, mRect.bottom, mRect.right, mRect.bottom, mBorderPaint);
}
That method gets called in both cases, i.e. for my CardView
and CustomTextView
but it doesn't draw the border for my CardView
! I suspect it's because it extends LinearLayout
and not TextView
but shouldn't it work anyway?
Ok I figured it out. My 3rd CustomTextView
in my CardView
layout was covering the border beneath it so the line wasn't visible.