I understand that MATCH_PARENT
means that the View wants to be as big as its parent (minus padding), and WRAP_CONTENT
means that the View wants to be just big enough to enclose its content (plus padding)
My question is, what happens when a MATCH_PARENT
view (view A) is put inside a WRAP_CONTENT
view (view B)? How are the parameters of the two views A and B calculated in this case?
It fills all the space possible allowed for its parents, looking up on hierarchy.
If the parent of the WRAP_CONTENT view has a size limit, it will take that size. If no hierarchical parent has size (all are wrap_content until the root view) it will take up the whole screen.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.