移动videoView ...用翻译动画 [英] move videoView...using translation animation
问题描述
我基本上尝试移动 VideoView
我必须使用在包含布局的动画师。但是,视频视图永远不会发生变化。它的布局动作,而不是视频本身?
我怎样才能使视频的举动?
这是我到目前为止所。
在 slideleft.xml
< XML版本=1.0编码=UTF-8&GT?;
<设置的xmlns:机器人=http://schemas.android.com/apk/res/android>
<翻译机器人:fromXDelta =0%安卓toXDelta = - 50%机器人:时间=200
机器人:fillAfter =真正的机器人:fillEnabled =真
机器人:插=@机器人:动画/ accelerate_decelerate_interpolator/>
< /集>
在动画部分activiy (重新初始化动画每次只是为了确保)
公共无效videoSlideOut(时间长){
RN2 =新的Runnable(){
公共无效的run(){
动画SlideLeft = AnimationUtils.loadAnimation(Video.this,R.anim.slideleft);
动画SlideLeft2 = AnimationUtils.loadAnimation(Video.this,R.anim.slideleft);
((RelativeLayout的)findViewById(R.id.video_view_slider))startAnimation(SlideLeft)。
video.startAnimation(SlideLeft2);
}
};
hnd.postDelayed(RN2,时间);
}
我不认为你可以动画VideoView这样。 Basicly动画需要绘制窗口的缓存/层,然后蓬勃生机。但VideoView使用SurfaceView渲染视频。而且,据我所知,SurfaceView不能用动画动画类。
您可以尝试动画,但我不知道这是否会工作......
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);
}
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...
这篇关于移动videoView ...用翻译动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!