ShapeDrawable.ShaderFactory sf = new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width, int height) {
LinearGradient lg = new LinearGradient(0, 0, 0, border.getHeight(),
new int[] {
Color.CYAN,
Color.WHITE,
Color.WHITE
}, //substitute the correct colors for these
new float[] {
0, 0.45f, 0.55f, 1 },
Shader.TileMode.REPEAT);
return lg;
}
}
在此代码中,而不是使用Color.CYAN
我想为颜色插入十六进制值。有什么建议吗?
答案 0 :(得分:4)
new int[] {
Color.parseColor("#00FFFF"),
Color.WHITE,
Color.WHITE
},