渐变的实现有很多种xml实现是其中的一种。
渐变属性大概介绍
- <!--android:startColor="#aa000000" 渐变起始色值
- android:centerColor="" 渐变中间色值
- android:endColor="#ffffffff" 渐变结束颜色
- android:angle="45" 渐变的方向 默认为0 从做向右 ,90时从下向上 必须为45的整数倍
- android:type="radial" 渐变类型 有三种 线性linear 放射渐变radial 扫描线性渐变sweep
- android:centerX="0.5" 渐变中心相对X座标只有渐变类型为放射渐变时有效
- android:centerY="0.5" 渐变中心相对Y座标只有渐变类型为放射渐变时有效
- android:gradientRadius="100" 渐变半径 非线性放射有效
- -->
- <gradient
- android:startColor="#000000"
- android:endColor="#ffffff"
- android:type="sweep"
- android:centerX="0.5"
- android:centerY="0.5"
- android:gradientRadius="100"/></span>