开发者

Hierachy of android:layout_width/ height between containers and views

开发者 https://www.devze.com 2022-12-16 17:33 出处:网络
What is the relationship between android:layout_width & android:layout_height in the container and the views contained within?

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 Bu开发者_StackOverflowtton 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 This article explains it very well

0

精彩评论

暂无评论...
验证码 换一张
取 消