Hi, I recently struggled with an apparently simple Android layout: I wanted a WebView
above a Button
. It worked fine with the following parameters:
WebView:
Height: wrap-content
Weight: unset (by the way, what is the default?)
Button:
Height: wrap-content
Weight: unset
However if the web page became too big it spilled out over the button. I tried various combinations of weights and heights, and all except one either completely hide the button, or partially cover it. This is the one that works (copied from http://code.google.com/p/apps-for-android/source/browse/trunk/Samples/WebViewDemo/res/layout/main.xml):
WebView:
Height: 0
Weight: 1
Button:
Height: wrap-content
Weight: unset
If you change any of those, e.g. give button a weight or change the WebView
height to wrap-content then it doesn't work. My question is: Why? Can someone please explain what on Earth the android layout system is thinking?