When I have the following, it shows top layout with four colors has much smaller area than the bottom layout area.
According to this documentation, when you add more
If the orientation of linearlayout is vertical,then set layout_height as 0dp. In case of horizontal layout set layout_width as 0dp.
If we do not follow above rules,the view tends to take up space as per specified attributes and hence the alignment is not as per expectation.