I am working in Android Studio and I want to make a gradient of a canvas in a onDraw
; This is the gameview code:
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.GREEN); //Color fondo
}
How can the gradient be applied to the canvas in the method onDraw
?
I propose this solution (the gradient is from top to bottom):