I have a ViewAnimator that contains two child views. I’d like for the ViewAnimator to be the size of the first child, regardless of which child is currently active. Is this possible with a bit of configuration or do I have to implement my own subclass and override onMeasure, etc?
I have a ViewAnimator that contains two child views. I’d like for the ViewAnimator
Share
I ended up solving this by extending
ViewAnimator, overridingonMeasureand setting the dimensions of the layout to the dimensions of the first child. Here’s what I came up with. It’s basically a small modification on theFrameLayout.onMeasuremethod.And the attribute defined in
res/values/attrs.xml: