Dim Gradient1 As GradientDrawable
Dim Clrs(3) As Int
Clrs(0) = Colors.Black
Clrs(1) = Colors.White
Clrs(2) = Colors.Black
Gradient1.Initialize("TOP_BOTTOM", Clrs)
The argument Colors is an array so you can use more than 2 colors to create the gradient.
B4X:Dim Gradient1 As GradientDrawable Dim Clrs(3) As Int Clrs(0) = Colors.Black Clrs(1) = Colors.White Clrs(2) = Colors.Black Gradient1.Initialize("TOP_BOTTOM", Clrs)
Yes, exactly, it is the Radial Gradient.I see you want a Radial Gradient?
I am sure it is possible (GradientDrawable | Android Developers) even with reflection.
Sub Activity_Create(FirstTime As Boolean)
Dim GD As GradientDrawable
GD.Initialize("TOP_BOTTOM", Array As Int(Colors.White, Colors.Black))
Activity.Background = GD
SetRadialGradient(GD, Activity.Height/2)
End Sub
Sub SetRadialGradient(GD As GradientDrawable, radius As Float)
Dim r As Reflector
r.Target = GD
r.RunMethod2("setGradientType", 1, "java.lang.int")
r.RunMethod2("setGradientRadius", radius, "java.lang.float")
End Sub
What do you need?
Consider adding:
B4X:r.RunMethod2("setShape", 0, "java.lang.int")