可绘制设计3个角落,一个颜色相同,另一个角落与其他颜色

时间:2017-11-15 06:57:46

标签: android android-layout

颜色代码:e32b0f,d03559,我想设计一下它的背景画请帮帮我

1 个答案:

答案 0 :(得分:1)

    Try,
    int colors[] = { 0xff255779, 0xfcc6c0cd };

                GradientDrawable gradientDrawable = new GradientDrawable(
                        GradientDrawable.Orientation.TOP_BOTTOM, colors);

                view.setBackgroundDrawable(gradientDrawable);

1. choose color and add color hex code in colors array.
2. GradientDrawable using and set orientation properties.[ex. GradientDrawable.Orientation.TOP_BOTTOM]
3. set view background [ex. Linearlayout.setBackgroundDrawable(gradientDrawable);]