Inner Circle Shadow Canvas for Android

I need to make an inner shadow and gradient on the circle that I draw with the onDraw () method of my view, see this (sorry, because I'm new to StackOverflow, I cannot post images yet)

I will figure out how to make the gradient work, but I can’t get the inner shadow. All I have found so far is this post, but it seems a bit complicated and not quite what I need

I tried using setShadowLayer (), but I probably can't get it to work correctly, because in addition to the inner shadow, I also get the outer shadow, and this is not what I need

Any help would be appreciated.

Thanks!

+7
source share
2 answers

You can avoid the outer shadow by setting the clip in a circle, as this will limit the drawing only inside the circle.

+1
source

You need to draw 2 circles (one of them is smaller than the other), as with LinearGradient

The outer circle will have a LinearGradient with a "dark" color, and the smaller circle will also have a LinearGradient, but with a "lighter" color. both circles share SAME origin, which will generate what you expected (like a shadow ring)

hops it help

0
source

All Articles