How to Draw a Rect with gradient color?

isozforever

New Member
Licensed User
Longtime User
Hello!
I want to change the color to gradient. how?
canvas1.DrawRect(Rect1, Colors.RGB(30,30,calc1), True, 5dip)
 

keirS

Well-Known Member
Licensed User
Longtime User
You need to use the DrawDrawable function and pass it a GradientDrawable object.


B4X:
Dim GD As GradientDrawable
Dim Colours(2) As  Int
Colours(0) = Colors.Black
Colours(1) = Colors.White
GD.Initialize("TOP_BOTTOM",Colours)
Canvas1.DrawDrawable(GD,Rect1)
 
Upvote 0
Top