Dynamically resize speakers with ViewFlipper

I have a problem with layout size ...

I have a layout that consists of a ViewFlipper, a LinearLayout (containing a MapView) and a second LinearLayout 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 see 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 gap. Also, I see black / white space left over from the previous ViewFlipper when I switch to a shorter view.

Is there a slippery way to dynamically resize these elements so that the MapView layout expands to fill all the space not occupied by the ViewFlipper and bottom LinearLayout?

+9
android user-interface android-mapview viewflipper
source share
1 answer

Try adding android:measureAllChildren="false" to your ViewFlipper

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

All Articles