Let's assume a device of 800x1280 pixels in portrait mode with the following layout:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MyScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none"
android:fadingEdgeLength="0dip" >
<LinearLayout
android:id="@+id/MyLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
and with android:configChanges="orientation" in the Activity manifest.
Dynamically I add two childs views to MyLinearLayout with Layout of width = MATCH_PARENT and height = getWindowManager().getDefaultDisplay().getHeight(). So, I can scroll vertically between the two childs, each occuping a entire screen.
Now, when the device gets in landscape, the child's width get the dimension of 1280, stretching from the original 800, because of the MATCH_PARENT attribute.
Vertically, they are not stretched, since they were created with a fixed height of 1280 originally, they keep with 1280 of height.
What's the proper way to stretch this views vertically?
If I try to child.setLayoutParams inside onConfigurationChanged to width = MATCH_PARENT and height = 2048 (which is 1280 * 1280/800), I get an exception.