I\'m a little confused about two XML properties: match_parent and fill_parent. It seems that both are the same. Is there any difference between the
When you set layout width and height as match_parent in XML property, it will occupy the complete area that the parent view has, i.e. it will be as big as the parent.
Hare parent is red and child is green. Child occupy all area. Because it's width and height are match_parent.
Note : If parent is applied a padding then that space would not be included.
So TextView hight = 300dp(parent hight) - (20(paddingTop)+10(paddingBottom)) = (300 - 30) dp = 270 dp
fill_parent is previous name of match_parent
For API Level 8 and higher fill_parent renamed as match_parent and fill_parent is deprecated now.
So fill_parent and match_parent are same.
The view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by {@code match_parent}.