For a custom view that draws a rectangle I see the following code in the onDraw
@Override
protected void onDraw(Canvas canvas) {
int left = getPaddingLeft();
int right = getWidth() - getPaddingLeft() - getPaddingRight();
//etc
canvas.drawRect(left, top, right, bottom, paint);
}
Shouldn't right
be:
int right = left + getWidth() + getPaddingRight();
i.e.
int right = getWidth() + left + getPaddingRight();
?
Right is essentially calculating width of the content so it's literally width without both paddings.
Excuse my crude ASCII explanation:
What you're suggesting: