The setting of gradual discoloration in my humble opinion just play the role of beautification, so only need to Master can!
Not complex to implement, method: Add a gradient effect to the background using XML
1. Add a Jbshape.xml file to the Res/drawable folder,
Right-click, new, Android XML
Then write the following code,
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <gradient android:angle= "android:centercolor=" #00FFFF " android:centerx=" 0.5 " android:centery= "0.5" android:endcolor= "#666666" android:startcolor= "#0099FF"/> <padding android:bottom= "7DP" android:left= "7DP" android:right= "7DP" android:top= "7DP"/> <corners android:radius= "4DP"/></shape>
the background of the gradient is set to complete.
Description
(1) Shape node configuration is the form of graphics, mainly including square, round, etc., the upper code is square.
(2) Gradient node main configuration start color, end color and middle point color, coordinates, gradient effect (0,90,180 from left to right gradient, 270 from top to bottom gradient) default from left to right.
(3) The radius of the corners node is configured around the rounded corners.
(4) The gradient has a starting color and a stop color of two colors, in fact, you can also set the middle color, that is, the first transition from the starting color to the middle color, and then the intermediate color transition to the end color, and CenterX and CenterY is set the coordinate position of the middle color
2. Add the android:background= "@drawable/jbshape" as a background image in the desired layout file
The effect of the implementation is as follows:
It seems to be not good, it is so simple!
Add the tags inside the Shap:
Solid: Fill
ANDROID:COLOR Specifies the color of the fill
Gradient: Gradient
Android:startcolor and Android:endcolor are the starting and ending colors, respectively,
Android:angle is a gradient angle and must be an integer multiple of 45.
In addition, the default mode of the gradient is android:type= "linear", that is, linear gradient,
You can specify a gradient as a radial gradient, android:type= "radial", and a radial gradient that requires a radius of android:gradientradius= "50".
Angle value corresponding to the location
Stroke: Stroke
Android:width= the width of the "2DP" stroke, android:color the color of the stroke.
We can also make the stroke into a dashed form, set in the following way:
Android:dashwidth= "5DP"
android:dashgap= "3DP"
Where android:dashwidth represents the width of a horizontal line such as '-', android:dashgap represents the distance separated by
Corners: Rounded Corners
The Android:radius is the radian of the angle, and the larger the value the greater the rounded.
We can also set the four corners to different angles,
The RADIUS attribute is not valid if you set five properties at the same time
android:radius= "20DP" sets the radius of Four Corners
android:topleftradius= "20DP" sets the radius of the upper-left corner
Android:toprightradius= "20DP" set the radius of the upper-right corner
android:bottomleftradius= "20DP" setting the radius of the lower right corner
Android:bottomrightradius= "20DP" set the radius of the lower left corner
padding: Interval
You can set the interval between the top and left four directions
Main reference: http://www.cnblogs.com/sydeveloper/archive/2013/09/08/3308038.html
http://blog.csdn.net/bear_huangzhen/article/details/24488337
Android Background Fade color