Hi there! In this post, I will tell you how to add a linear gradient background to an activity in android studio. The steps are listed below:
Create a new file in the drawable folder called background.xml. Set the Root element to 'shape'
Add the following code:
<gradient android:startColor="#0D973B" android:endColor="#1295B6" />
The gradient element allows us to make a gradient.
To add the gradient to your activity, add the background attribute in the head element. Set the value of the background attribute to "@drawable/background"
android:background="@drawable/filename"
So this is how you add a linear gradient background to an activity. If this post helped you, consider getting me some books. Bye for now.