设置#ffffff时,Color.parseColor会返回-1,所以下面判断有误: if(color == -1){ throw new IllegalArgumentException("cannot find color from the last attribute"); }