问题描述
我对两个 XML 属性有点困惑:match_parent
和 fill_parent
.好像两者是一样的.它们之间有什么区别吗?
I'm a little confused about two XML properties: match_parent
and fill_parent
. It seems that both are the same. Is there any difference between them?
推荐答案
它们是一样的(在 API 级别 8+ 中).使用 match_parent
.
They're the same thing (in API Level 8+). Use match_parent
.
FILL_PARENT(在 API Level 8 及更高版本中重命名为 MATCH_PARENT),这意味着视图希望与其父视图一样大(减去填充)
...
fill_parent
:视图应该与其父视图一样大(减去填充).从 API 级别 8 开始不推荐使用此常量,并替换为 match_parent
.
fill_parent
: The view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by match_parent
.
http://developer.android.com/reference/android/视图/ViewGroup.LayoutParams.html
这篇关于match_parent 和fill_parent 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!