版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yy471101598/article/details/54584726
//设置从上到下的渐变色
GradientDrawable gradient=new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM,new int[]{Color.RED,Color.YELLOW});
getWindow().setBackgroundDrawable(gradient);