views:

231

answers:

2

I have a webview and a table containing 4 buttons. I have set the height of the webview to 400px, so that the buttons are displayed at the bottom of the screen, in portrait mode. My problem is, when changed to landscape mode the buttons are not visible. So I need to change the height of the webview on runtime, when orientation is changed. Do anybody know how to achieve this? I am able to capture the orientation change, using 'onConfigurationChanged' function.

+2  A: 

Design your layout to avoid the hard-wired value of 400px. Not only will that not work in landscape mode on whatever emulator/device you are testing on, it will not work on smaller or larger screens the way you expect.

Please use a RelativeLayout, with attributes like android:layout_alignParentBottom for the buttons and android:layout_alignParentTop and android:layout_above for the WebView. Then, your layout will dynamically adapt to the available space.

CommonsWare
A: 
Bennet