Android gradient xml configuration

Here Gradient:

<? xml Version = " 1.0 " encoding = " UTF-8 " ?> 

<the Shape xmlns: Android = " http://schemas.android.com/apk/res/android " > 
    <-! 
    Android: startcolor = " aa000000 # "   gradient start color value 
    Android: centerColor = " "       gradient intermediate color value 
    Android: endColor = " #FFFFFFFF "     gradient end color 
    Android: angle = " 45 "       direction gradient from 0 by default when doing the right 90, from bottom up must be a multiple of 45 
    android:type="radial "        Gradient Type There are three linear linear radial gradation radial scanning linear gradient Sweep 
    Android: the centerX = " 0.5 "        when the gradation center relative X coordinate of only the gradient type of the radial gradation effective 
    Android: centerY = " 0.5 "        gradation center relative Y coordinate only gradient type radial gradation is valid 
    Android: gradientRadius = " 100 "     gradation nonlinear radiation effective radius
      -> 
    < gradient 
        Android: startcolor = " # b7bbd9 " 
        Android: endColor = " # 5CACEE " 
        Android: angle = "90"
        />

</shape>

With rounded corners background:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF" />
    <corners android:topLeftRadius="18px"
        android:topRightRadius="18px"
        android:bottomRightRadius="18px"
        android:bottomLeftRadius="18px"/>

    <!--
    android:startColor="#aa000000"  渐变起始色值
    android:centerColor=""      渐变中间色值
    android:endColor="#ffffffff "end of the gradient color
    android:angle="45 "0 is the default gradient direction from the right to make, from bottom to top 90 must be a multiple of 45
    android: type = "radial" Gradient Type There are three linear linear radial gradation radial scanning linear gradient Sweep 
    Android: the centerX = "0.5" gradation center relative X coordinate effective only when the gradient type of the radial gradation 
    android: centerY = "0.5" gradation center relative Y coordinate of the gradient type is effective only when the radial gradation 
    android: gradientRadius = "100" Nonlinear radiation effective radius of the gradient 
     -> 
    < gradient
         Android: startcolor = "# b7bbd9" 
        Android: endColor = "# 5CACEE" 
        Android: angle = "90 " 
        /> 
</ Shape >

 

The results show:

 Reference 01: https://www.jianshu.com/p/2600db55908f

Reference 02: https://www.jianshu.com/p/54b458d54ef8

Guess you like

Origin www.cnblogs.com/yang101/p/11762405.html