To achieve the gradient effect for the background, the most traditional method is to use psto make a gradient, but I am too lazy to learn the PS technology, and I am too lazy to add an image to the application, here we use a great method provided by Google to solve the background gradient function.
First, add an XML file to the drawable folder and write the following code:
<? XML version = "1.0" encoding = "UTF-8"?>
<Shape xmlns: Android = "http://schemas.android.com/apk/res/android">
<Gradient Android: startcolor = "#52 adcd" Android: endcolor = "#1c87b1"
Android: angle = "270.0" type = "parmname" text = "parmname">
</Gradient>
</Shape>
The corresponding attributes are relatively simple. We will not introduce them here. Android: Shape = "rectangle" indicates that the gradient shape is a rectangle. Android: angle = "270.0" indicates that the angle is 270. The gradient from top to bottom is changed. If I change to 0, the gradient is changed from left to right, if you change the gradient by 90.0, the gradient will go down from below. You can change the parameters to try the effect.