How To Animate Background In Android Studio or Make Color Changing Background - ILoveDeshi
Yes, it is Possible to animate your activity or splash background to make animated or change color automatically using a simple method. You Can make Smooth Gradient Colors in Background too. Welcome to ILoveDeshi.Com
How to Animate Activity Background Using Simple Drawables...
First of all Open Android Studio And Create A New Project Choose Empty Activity Layout Then Click on Next Enter Your Project Name "Animated Background" Choose Language "Java" Then Click on Finish.
What We Are Going To Do.
- Create two or more drawable files with different color gradients.
- Create one more another drawable with an animation-list tag and add all the created gradient drawable as the items.
- Use the animation-list drawable as the background of the view in the layout.
- Start the animation in the onCreate method of the Activity.
Create Drawable first.xml
Create Drawable second.xml
Now Create An Animation Drawable
Create an animate.xml drawable inside it, then we will define the items and set the first.xml and second.xml files as drawable.
Using Animation-List Drawable
You can use the animate.xml as the background in any Activity.
Now Start The Animation in Java of your MainActivity
In your activity or fragment class, you will have to start the animation and this can be done in your onCreate method as shown below.