颜色未知

时间:2018-10-26 14:46:10

标签: android colors

我正在尝试通过一个类使Color att成为一个整体。

我的代码是这样的:

    public class Global {
    public static boolean active;
    public static int textnormalcolors = Color.parseColor("FF000000");
    public static int textlightcolors = Color.parseColor("FF696969");
    public static int textdarkcolors = Color.parseColor("FFBFBFBF");

    public static int[] normalcolor = {Color.parseColor("#679acf"),Color.parseColor("#3b5e94")};
    public static GradientDrawable NormalGD = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, normalcolor);

    static int[] darkcolor = {Color.parseColor("#213351"),Color.parseColor("#000268")};
    public static GradientDrawable DarkGD = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, darkcolor);

}

错误是这样的:

  

原因:java.lang.IllegalArgumentException:颜色未知           在android.graphics.Color.parseColor(Color.java:225)           在com.example.northlandcaps.crisis_response.Global。(Global.java:8)

1 个答案:

答案 0 :(得分:0)

您的字符串十六进制颜色必须以#开头

public static int textnormalcolors = Color.parseColor("#FF000000");