Android – Hierachy of android:layout_width/ height between containers and views

android

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

Best Answer