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
312 views
in Technique[技术] by (71.8m points)

android - Is deprecated word the only difference between fill_parent and match_parent

I found that both fill_parent and match_parent means the same thing

  • fill_parent means that the view wants to be as big as its parent, minus the parent's padding, if any.
  • match_parent means that the view wants to be as big as its parent, minus the parent's padding, if any.

The only difference that I found is that fill_parent is deprecated starting from API Level 8 and is replaced by match_parent

However, I didn't notice any difference between these two. If both are the same then, why is fill_parent deprecated. Can anyone explain any differences between these two except for the fact that one is deprecated and the other isn't?

I have gone through http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

As you said they are exact the same. As Romain Guy said, they have changed the name because "fill_parent" was confusing for developers. As matter of the fact, "fill_parent" does not fill the remaining space (for that you use the weight attribute) but it takes as much space as its layout parent. That's why the new name is "match_parent".


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

...