This is a quick tutorial on how to make a moving gradient background on Android. To achieve this all we need is AnimationList. Lets start! First we will create five gradient drawables in different files, as follows.
|
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:angle="225" android:endColor="#1a2980" android:startColor="#26d0ce" /> </shape> |
|
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:endColor="#614385" android:startColor="#516395" android:angle="45"/> </shape> |
|
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:endColor="#1d2b64" android:startColor="#f8cdda" android:angle="135"/> </shape> |
|
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:endColor="#ff512f" android:startColor="#dd2476" android:angle="45"/> </shape> |
Read more…