RelativeLayout causes animation not to work?

ⅰ亾dé卋堺 提交于 2019-12-04 04:12:20

I'm not sure if using a third-party library is a viable solution for you, but I strongly recommend NineOldAndroids, so you can use the Animation capabilities of 3.0+ in earlier versions of Android. They make this job WAY easier.

Here's the link: http://nineoldandroids.com/

Then, on you activity you can do something as easy as:

VideoView view = (VideoView) findViewById(R.id.videoplayer);
animate(view).scaleX(0).scaleY(0).setDuration(500L);

I've tested it using RelativeLayout and it works as expected.

EDIT: If you wish to use the native honeycomb implementation, this specific API is 3.1+ and it should be used nativelly like the following:

view.animate().scaleX(0).scaleY(0).setDuration(500L);

And if you wish to nativelly support 3.0, you'll have to use it like this:

AnimatorSet set = new AnimatorSet();
set.playTogether(
    ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 0.0f),
    ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 0.0f),
);
set.setDuration(500).start();

I am not sure but In My app i have RelativeLayout and Animaion and also the Video works fine.

If VideoView is the Only View of the Layout then put the relativeLayout height and Width as fill_parent and also for the VideoView and then try.

Hope it will works. If not then let me know.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!