How Can I Animate Changing the Size of a VideoView?
<p>I have a VideoView that I want to change the size of dynamically in my app. By extending the VideoView class, I have successfully gotten both the video and videoView to change size correctly. However, I'd like to be able to transition between the two sizes more gradually. How can I do that? I've tried a scaling animation, but while that changes the VideoView layout's size, the video itself does not scale. Thoughts?</p>

<p>Here is my video class:</p>

<pre><code>public class MyVideoView extends VideoView {

    private int mForceHeight,mForceWidth;
    private int mOrigWidth, mOrigHeight, mMinWidth, mMinHeight;


    public MyVideoView(Context context) {
        super(context);
    }

    /* Will cause inflator errors if not present */
    public MyVideoView(Context context, AttributeSet attrs){
        super(context, attrs);
    }

    public void setDimensions(int w, int h) {
        this.mForceHeight = h;
        this.mForceWidth = w;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

        if (mForceHeight != 0)
            setMeasuredDimension(mForceWidth, mForceHeight);
        else
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }


    public void setOrigDimens(int width, int height) {
        mOrigWidth = width;
        mOrigHeight = height;

        mMinWidth = width/4;    // My own decision for the small size
        mMinHeight = height/4;
    }


    public void setSmallView() {
        setNewViewSize(mMinWidth, mMinHeight);
    }


    public void setNormalView() {
        setNewViewSize(mOrigWidth, mOrigHeight);
    }


    /* RESIZES THE VIEW */
    public void setNewViewSize(int width, int height) {
        mForceWidth = width;
        mForceHeight = height;
        setDimensions(width, height);
        getHolder().setFixedSize(width, height);
    }
}
</code></pre>

<p>Here is the scaling code I tried:</p>

<pre><code>Animation scaling = new ScaleAnimation(1.0f, 0.2f, 1.0f, 0.2f);
scaling.setDuration(2000);
startAnimation(scaling);
</code></pre>

<p>Any help is much appreciated!</p>