Good day.

Trying to get the shadow of a round custom button. I create a circle under the button and draw a gradient:

mRadialGradient = new RadialGradient(getWidth()/2, (getHeight()/2)+1,r, new int[]{Color.argb(255,0,0,0),Color.argb(255,255,255,255)}, new float[]{0.2f, 0.9f}, Shader.TileMode.CLAMP); mPaint.setShader(mRadialGradient); canvas.drawCircle(getWidth()/2, getHeight()/2,(getHeight()/3)+1,mPaint); 

I try to twist the transition array, does not change anything. What is the trouble with this problem?

Thanks in advance.

    1 answer 1

    Found the answer in java source. If you add only two colors to the array of colors, they are automatically distributed over the surface. The problem was solved by adding one more color to the array