To add to Yoav's solution.
On my Galaxy Nexus 4.2 stock Android, the solution given doesn't work.
If the array doesn't contain a 0.0f and 1.0f, it appears to be ignored.
My final solution was:
int[] colors = {Color.RED, Color.BLUE, Color.RED};
float[] positions = {0, Xf/360f, 1};