width/ height between containers and views

What is the relationship between android:layout_width & android:layout_height in the container and the views contained within?

For instance if I have a LinearLayout with the layout width and height set to fill_parent, and I have a Button with those values set to wrap_content it uses the value from the Button, like the Button values overide the LinearLayout.

However if i swap them around so that the LinearLayout values are both wrap_content and the Button values are now fill_parent it still uses wrap_content, this time not overriding the values, but using the values supplied with the LinearLayout.

Could someone explain how they relate as this is very confusing to me?

Thanks

Kyros


http://developer.android.com/guide/topics/ui/how-android-draws.html这篇文章解释得非常好

链接地址: http://www.djcxy.com/p/16644.html

上一篇: 使用“fill”时出现RelativeLayout问题

下一篇: 容器和视图之间的宽度/高度