Sreekanth Karumanaghat
Sreekanth Karumanaghat

Reputation: 3403

Line with varying gradient in canvas

I need to draw a line with a varying gradient in a canvas. Any idea how to do this? I have done a lot of search and have not been able to find any answer.

Upvotes: 0

Views: 1126

Answers (1)

Blumer
Blumer

Reputation: 5035

Use the setShader() method on your Paint object to set it to a gradient (likely a LinearGradient, but there are a handful of things you can use. Check the documentation). Then draw away!

Upvotes: 1

Related Questions