android 颜色设透明度和颜色渐显
<color name="sub_tx_color">#6b6b6b</color>
如改为80%透明
256*0.8 再转换成16进制 cc
<color name="sub_tx_color">#cc6b6b6b</color>
颜色渐显
<gradient>
Specifies a gradient color for the shape.
attributes:
android:angle
Integer. The angle for the gradient, in degrees. 0 is left to right, 90 is bottom to top. It must be a multiple of 45. Default is 0.
android:centerX
Float. The relative X-position for the center of the gradient (0 - 1.0). Does not apply when android:type="linear".
android:centerY
Float. The relative Y-position for the center of the gradient (0 - 1.0). Does not apply when android:type="linear".
android:centerColor
Color. Optional color that comes between the start and end colors, as a hexadecimal value or color resource.
android:endColor
Color. The ending color, as a hexadecimal value or color resource.
android:gradientRadius
Float. The radius for the gradient. Only applied when android:type="radial".
android:startColor
Color. The starting color, as a hexadecimal value or color resource.
android:type
Keyword. The type of gradient pattern to apply. Valid values are:
Value Description
"linear" A linear gradient. This is the default.
"radial" A radial gradient. The start color is the center color.
"sweep" A sweeping line gradient.
例子,中心颜色为白色且中心颜色半径为100,向四周渐显.注:不设type时默认为线性渐显
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:type="radial"
android:gradientRadius="100"
android:startColor="#ffffff"
android:centerColor="#000000"
android:endColor="#000000"
/>
</shape>

浙公网安备 33010602011771号