Difference between match_parent,fill_parent,wrap_content in android

Difference between match_parent,fill_parent,wrap_content in android

Define Major differences between match_parent, fill_parent, wrap_content attributes with examples.

  • Match_Parent : Definition of match parent is to match width and height same as its parent attribute tag. For example in every layout xml file firstly Layout defined because each and every widgets code can only be write inside it. So that first layout defining are called as its parent and so on it, you declare layout_width as match_parent and layout_height as match_parent then it will set the height and width of that selected widget same as your parent layout layout tag.
  • Fill_Parent : Definition of fill parent attribute is to completely fill parent tag area. For example if your parent tag has 100 dp set into width and also 100 dp into height then it will cover your whole parent area. Here parent are called as your main above first defining layout tag.
  • Wrap_Content : Definition of wrap content is to cover the only its included content + declared padding size. For example if you are declaring button name as “button” and set its heigh & width as wrap_content then it will creates button contain will ” button ” name size and dose not occupy more then its content area.

Leave a Reply

Your email address will not be published. Required fields are marked *