Android 安卓背景动画

Android 安卓背景动画,android,android-animation,Android,Android Animation,目前,我使用 BitmapDrawable bd = new BitmapDrawable(getResources(), mBlurredMap); mLytProfileCover.setBackground(bd); 我怎样才能做到这一点?例如,背景的alpha在500毫秒内从0变为1的淡入动画 谢谢。这会将整个线性布局的可见性从0更改为1。我正在寻找一种只改变其背景的方式,而不是线性布局中的内容。@windchimez有一个视图作为布局的第一个子视图。将背景设置为视图,并设置动画,而不

目前,我使用

BitmapDrawable bd = new BitmapDrawable(getResources(), mBlurredMap);
mLytProfileCover.setBackground(bd);
我怎样才能做到这一点?例如,背景的alpha在500毫秒内从0变为1的淡入动画


谢谢。

这会将整个线性布局的可见性从0更改为1。我正在寻找一种只改变其背景的方式,而不是线性布局中的内容。@windchimez有一个
视图作为布局的第一个子视图。将背景设置为
视图
,并设置动画,而不是布局。问得好,因为Android中的一切对我来说都太静态了。如果您使用CustomView,会出现很多问题。。。
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mLytProfileCover, View.ALPHA, 0.0f, 1.0f);
alphaAnimator.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationStart(final Animator animation) {
        mLytProfileCover.setBackground(bd);
    }
});
alphaAnimator.setDuration(500);
alphaAnimator.start();