Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

move videoView...using translation animation

I am basically trying to move the VideoView I have by using an animator on the layout that contains in. However, the video view never moves. Its layout moves, but not the video itself?

How can I make the video move?

here is what i have so far.

the slideleft.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0%" android:toXDelta="-50%" android:duration="200"
    android:fillAfter ="true" android:fillEnabled="true"
android:interpolator="@android:anim/accelerate_decelerate_interpolator" />
</set>

the animation portion in activiy (reinitialized animators everytime just to make sure)

public void videoSlideOut(long time){
    rn2 = new Runnable(){
        public void run() {
            Animation SlideLeft = AnimationUtils.loadAnimation(Video.this, R.anim.slideleft);
            Animation SlideLeft2 = AnimationUtils.loadAnimation(Video.this, R.anim.slideleft);
            ((RelativeLayout) findViewById(R.id.video_view_slider)).startAnimation(SlideLeft);
            video.startAnimation(SlideLeft2);
        }
    };
    hnd.postDelayed(rn2, time);

}
like image 974
Mathew Kurian Avatar asked Nov 13 '22 12:11

Mathew Kurian


1 Answers

I don't think you can animate VideoView like this. Basicly animation takes drawing cache/layer of the window and then animates it. But VideoView uses SurfaceView for rendering video. And, as far as I know, SurfaceView can't be animated with Animation class.

You can try Animator but I'm not sure if it'll work...

like image 97
MatrixDev Avatar answered Nov 16 '22 02:11

MatrixDev