我正在尝试设计欢迎活动,我需要在 3秒内使用动画更改布局活动背景图片。
我找不到这个问题的答案,我在网上搜索了此问题,但没有解决办法。
答案 0 :(得分:0)
Drawable backgrounds[] = new Drawable[2];
backgrounds[0] =ResourcesCompat.getDrawable(getResources(), R.drawable.back_company1, null);
backgrounds[1] = ResourcesCompat.getDrawable(getResources(), R.drawable.white, null);
crossfader = new TransitionDrawable(backgrounds);
welcome_parent.setBackgroundDrawable(crossfader);
crossfader.startTransition(2500);