Pages Navigation Menu

Coding is much easier than you think

Difference between Wrap content and Fill parent/match parent

 
Wrap content: As the name suggests, it refers to wrapping a widget€™s/view contents within the view. The wrap content can be best explained using button view. For eg: in case of button, Button name is €œwrap€ at first and now you change it to wrapcontent€, the size of the button increases to wrap its content.
 
** UPDATE: Android Complete tutorial now available here.
 
This is due to the reason that the attributes android:layout_width and android:layout_height is set to wrap_content as shown below.

                               wrapcontent_1

wrapcontent_2

Fill Parent/Match parent: As the name suggest, fills/matches the screen (size of parent layout). Parent refers to the area occupied by the layout in an activity.

Note: If the fill parent/match parent is used in your layout, the views in your activity get adjusted according to size of your mobile screen to match the parent. (since bigger screen phones will have larger screen area)

fill parent

 

One Comment

  1. Nice wat I need is exactly explained here…..:)