Understanding Android’s

The values for left, top, right and bottom are measured from their respective edge.

So left=0dp, top=0dp, bottom=0dp & right=50dp will give you a rectangle that is (match_parent – 50dp) wide and not 50dp wide. Therefore larger values for “right” will actually give you a smaller rectangle.

The same would apply to the other value, but these would behave as expected in most cases, its just “right” that might cause confusion.

Leave a Comment