Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
161 views
in Technique[技术] by (71.8m points)

android - match_parent和fill_parent有什么区别?(What is the difference between match_parent and fill_parent?)

I'm a little confused about two XML properties: match_parent and fill_parent .

(我对两个XML属性有点困惑: match_parentfill_parent 。)

It seems that both are the same.

(似乎两者都是一样的。)

Is there any difference between them?

(它们之间有什么区别吗?)

  ask by vnshetty translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

They're the same thing (in API Level 8+).

(它们是相同的(在API级别8+中)。)

Use match_parent .

(使用match_parent 。)

FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)

(FILL_PARENT(在API级别8及更高级别重命名为MATCH_PARENT),这意味着视图要与其父级一样大(减去填充))

...

(...)

fill_parent : The view should be as big as its parent (minus padding).

(fill_parent :视图应该与其父视图一样大(减去填充)。)

This constant is deprecated starting from API Level 8 and is replaced by match_parent .

(从API级别8开始不推荐使用此常量,并将其替换为match_parent 。)

http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html

(http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...