The difference between the three attributes of match_parent, wrap_content, and fill_parent

android layout--Android difference between fill_parent, wrap_content and match_parent The

three attributes are all used to adapt to the horizontal or vertical size of the view
1) fill_parent

setting a widget's layout to fill_parent will force the widget to expand to fill the layout unit as much as possible lots of space. This is roughly the same as the dockstyle property of Windows controls. Setting a top layout or control to fill_parent will force it to fill the entire screen.


2) wrap_content

Setting the size of a view to wrap_content will force the view to expand to display the full content. Take TextView and ImageView controls as an example, setting wrap_content will display the text and images inside them completely. Layout elements will change size according to the content. Setting a view's size to wrap_content is roughly equivalent to setting the Windows control's Autosize property to True.


3) match_parent
   In Android2.2, match_parent and fill_parent have the same meaning. The two parameters have the same meaning, and match_parent is more appropriate, so both words can be used from 2.2. Then if you consider the usage of the lower version, you need to use fill_parent to


summarize:
the effect of match_parent and fill_parent is the same, but it is a new one and an old one, and the function is to make the control fill the entire screen

. The function of wrap_content is to change the size according to the content, will display its content in its entirety

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326837483&siteId=291194637