The GradientDrawable is missing Radial fill, where the fill is like a starburst radiating from the center. This will give buttons etc. more of a 3D effect. Other HTML products I've used will also let you specify the location of the center of the radial (and linear fills to). Example: at 10,10 from the top of the image.
I don't know why Radial fill is missing, maybe it is an Android limitation?
You can do it with the help of the Reflection library:
B4X:
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
You can do it with the help of the Reflection library:
B4X:
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
If the exact shape is special, there is always the option of moving from one edge to the other by lines/arcs/circles in a loop, coloring each step in a color matched by the loop index (changing the R,G,B parameters).
This is how I did this https://www.b4x.com/android/forum/threads/class-special-drawables.19487/
That uses more trigonometry than what can run in real time at a high framefrate.
It was the first thing I considered.
Right now I'm using a linear gradient, simply rotated to match the inner point. Then clipped using ExDraw to a slice of the circle.
It's not perfect, but close.