3

I am trying to create a gradient background for a live wallpaper. I can create it with two colours, but it won't allow me to have three.

Here is the code that I am currently using:

int[] colors = { Color.GREEN, Color.MAGENTA, Color.YELLOW };
float[] positions = {0, 1, 2};

LinearGradient gradient = new LinearGradient(0, 0, 0, height, colors,
    positions, android.graphics.Shader.TileMode.CLAMP);

The result is a gradient from green to magenta, but without any yellow. Any assistance would be greatly appreciated. Here is an image of the result that I am currently getting:

Image of Problem

4

0 回答 0