I am working on creating an Action Bar like the one from the new Android UI Patterns and I am running into a bit of trouble. I have a ViewSwitcher with two layouts in it. When the user taps the search button I animate between the two layouts. The problem is that the layouts are different sizes and I can’t figure out how to make them take up the same amount of space. Here’s what I mean. p.s. forgive the bad art, they are just place holders 😉
The red box is right up against the ViewSwitcher and there is a gap between that and the action bar for this layout:

but not this one:

What I want is to tell the layouts in the ViewSwitcher to be the same size. How can I do this?
You can try setting android:minHeight on the smaller one to be whatever the height of the larger one is. Or maybe setting it on the ViewSwitcher itself.
Idea:
The
ViewSwitcheronly lets you add twoViews and in your case they are twoViewGroups. You can callView#measureon each of the views you’re adding to theViewSwitcher. It looks like you should useViewGroup.LayoutParams.WRAP_CONTENTfor each parameter tomeasure. Then you can callView.getMeasuredHeighton each view. What ever is the larger set the smaller view usingView#setMinHeight.