Implement Gradient Transition similar to Instagram LogIn Screen.
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
</style>
android:theme="@style/MyTheme"
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
color1.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#7551a1"
android:endColor="#516397"
android:angle="0"/>
</shape>
color2.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#7551a1"
android:endColor="#419c99"
android:angle="45"/>
</shape>
color3.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#396ce4"
android:endColor="#7745c6"
android:angle="90"/>
</shape>
color4.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#7440ef"
android:endColor="#e167ba"
android:angle="135"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/color1"
android:duration="8000" />
<item
android:drawable="@drawable/color2"
android:duration="8000" />
<item
android:drawable="@drawable/color3"
android:duration="8000" />
<item
android:drawable="@drawable/color4"
android:duration="8000" />
</animation-list>
android:background="@drawable/animation"
AnimationDrawable animation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
animation = (AnimationDrawable) layout.getBackground();
//Animation Start to End Fade effect
animation.setEnterFadeDuration(5000);
animation.setExitFadeDuration(1000);
}
@Override
protected void onResume() {
super.onResume();
if (animation != null && !animation.isRunning())
animation.start();
}
@Override
protected void onPause() {
super.onPause();
if (animation != null && animation.isRunning())
animation.stop();
}