Code example for LinearGradient

0
 
        @Override 
        protected void onDraw(Canvas canvas) {
            Paint p = new Paint();
            p.setShader(new LinearGradient(0.0f, 0.0f, 0.0f, getHeight(), 0xff000000,
                    0xff333333, Shader.TileMode.CLAMP));
 
            canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), p);
        } 
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE