本文介绍了一个WRAP_CONTENT视图内的MATCH_PARENT视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知, MATCH_PARENT 表示视图想成为大如其父(负填充),而 WRAP_CONTENT 意味着视图想要刚好足够大包围其内容(加上填充)

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)

我的问题是,当一个 MATCH_PARENT 视图(view A)是把 WRAP_CONTENT 视图中(会发生什么鉴于B)?怎么是两个视图A和B在这种情况下计算参数?

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.

如果该WRAP_CONTENT视图的父有大小限制,将采取大小。
如果没有层次父有大小(所有人都WRAP_CONTENT直到根视图),它会占用整个屏幕。

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.

这篇关于一个WRAP_CONTENT视图内的MATCH_PARENT视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 09:50