Android 画渐变的背景

public void drawBackground()  

    {  

        GradientDrawable grad = new GradientDrawable(   

                   Orientation.TL_BR,  

                   new int[] {Color.rgb(0, 0, 127),  

                              Color.rgb(0, 0, 255),  

                              Color.rgb(127, 0, 255),  

                              Color.rgb(127, 127, 255),  

                              Color.rgb(127, 255, 255),  

                              Color.rgb(255, 255, 255)}   

        );   

  

        this.getWindow().setBackgroundDrawable(grad);  

    }

  

 

posted @ 2012-08-18 16:02  GreyWolf  阅读(245)  评论(0编辑  收藏  举报