Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.drawable.ShapeDrawable; public class Main { private static ShapeDrawable.ShaderFactory getShaderFactory(final int startX, final int endX) { return new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { return new LinearGradient(startX, 0, endX, 0, new int[] { 0xFFDCDAD5, 0xFFFDFDF4, 0xFFFFFFFF, 0xFFFDFBEF }, new float[] { 0, 0.18f, 0.48f, 1 }, Shader.TileMode.REPEAT); } }; } }