【发布时间】:2026-02-24 08:40:01
【问题描述】:
我只想在 VideoView 对象上创建淡出效果。 问题:虽然我确实为动画设置了一定的持续时间,但看起来没有持续时间。 VideoView 对象立即消失..
我已经尝试过的事情:
AlphaAnimation anim = new AlphaAnimation(1, 0);
anim.setDuration(2000);
anim.setFillAfter(true);
mVideoView.setVisibility(View.VISIBLE);
mVideoView.startAnimation(anim);
第二次尝试:
Animation anim = AnimationUtils.loadAnimation(this, R.anim.fadeout);
anim.setFillAfter(true);
mVideoView.startAnimation(anim);
in fadeout.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
>
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="2000"
/>
</set>
如果有人可以在这里帮助我,我会很高兴。
【问题讨论】:
标签: java android animation fadeout duration