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);  

    }

  

原文地址:https://www.cnblogs.com/greywolf/p/2645545.html