android随机颜色的获取

    public  static int getRandomColor(){
        Random random=new Random();
        int r=0;
        int g=0;
        int b=0;
        for(int i=0;i<2;i++){
            //       result=result*10+random.nextInt(10);
            int temp=random.nextInt(16);
            r=r*16+temp;
            temp=random.nextInt(16);
            g=g*16+temp;
            temp=random.nextInt(16);
            b=b*16+temp;
        }
        return Color.rgb(r,g,b);
    }

  方法比较笨,不过,可以达到效果

posted @ 2016-05-16 10:22  蓝冷然  阅读(2161)  评论(0编辑  收藏  举报