我想要创建一个颜色变量来引用它的质量,除非我似乎只能得到R,G,want值,我不知道如何单独设置每个变量。
我想做这样的事:
private int ReturnColor(int a, int r, int g, int b) {
return Color.argb(a, r, g, b);
}
if (ReturnColor(Alpha, Red, Green, Blue) == Dawn) Then...在黎明将是一个颜色,我想我可以做一个定制类,但我希望有一个更直截了当的方法。
编辑:最后我只创建了一个带有int、R、G和B变量的自定义类。
public class CustomColor {
int A;
int R;
int G;
int B;
public CustomColor() {}
public CustomColor(int a, int r, int g, int b) {
A = a;
R = r;
G = g;
B = b;
}
private int ReturnColor(int a, int r, int g, int b) {
return Color.argb(a, r, g, b);
}
public boolean EqualTo(CustomColor c) {
if(A == c.A && R == c.R && G == c.G && B == c.B) return true;
return false;
}
}//End CustomColor发布于 2011-10-15 00:30:11
颜色类中声明了一些静态颜色,如Color.WHITE
如果你想自己做颜色,你可以使用0xFFFFFFF第一个FF是alpha,第二个是红色,第三个是绿色,最后一个是蓝色。
即
CYAN = 0xff00ffff;
https://stackoverflow.com/questions/7774772
复制相似问题