0

At the moment i have a static plain blue background color on my surfaceview, I wanted to know a way to get a blue gradient from deep blue to light blue vertically. Currently I set the background color like this

         canvas.drawRGB(15,03,175);

Any tips or advice will be appreciated, thank you.

kabuto178
  • 3,129
  • 3
  • 40
  • 61
  • You can get help from here :-http://stackoverflow.com/questions/2936803/how-to-draw-a-smooth-dithered-gradient-on-a-canvas-in-android – Ali Imran Dec 08 '12 at 14:03

1 Answers1

2

Found my answer in the form of paint's set shader, this works nicely for the moment

         Paint gradPaint = new Paint();
         gradPaint.setShader(new LinearGradient(0,0,0,getHeight(),Color.BLUE,Color.CYAN,Shader.TileMode.CLAMP));
         canvas.drawPaint(gradPaint);
         //Where getHeight() is the height of the canvas
kabuto178
  • 3,129
  • 3
  • 40
  • 61