如何像Instagram应用程序一样创建动画背景渐变?
2022-09-03 06:22:21
创建过渡可绘制对象以在用于背景的两个可绘制对象之间切换。
<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">
<!-- use whatever drawables you want, gradients, shapes etc-->
<item android:drawable="@drawable/start" />
<item android:drawable="@drawable/end" />
</transition>
TransitionDrawable trans = (TransitionDrawable) myLayout.getBackground();
trans.startTransition(2000);