Resizing layouts dynamically with ViewFlipper

android, android-mapview, user-interface, viewflipper

Solution

Try to add `android:measureAllChildren="false"` to your ViewFlipper

<ViewFlipper
     android:width="match_parent"
     android:height="wrap_content"
     android:measureAllChildren="false" >
<!-- Top elements --> 
</ViewFlipper>

Problem

I have a layout sizing issue... I have a layout which consists of a ViewFlipper, a LinearLayout (containing a MapView), and a 2nd LinearLayout all in a vertical row. ``` <LinearLayout android:width="match_parent" android:height="match_parent" > <ViewFlipper android:width="match_parent" android:height="wrap_content" > // Top elements </ViewFlipper> <LinearLayout android:width="match_parent" android:height="match_parent" > // MapView </LinearLayout> <LinearLayout android:width="match_parent" android:height="wrap_content" > // Bottom elements </LinearLayout> </LinearLayout> ``` The problem I'm seeing is that when I change the ViewFlipper to show a shorter view with showNext() or showPrevious(), the middle LinearLayout does not expand to fill the space. Also, I see black/empty space left over from the previous ViewFlipper view when I change to a shorter view. Is there a slick way to dynamically resize these elements so that the MapView layout will expand to fill all space not occupied by the ViewFlipper and bottom LinearLayout?

Original source