I am having difficulty using the Reflector library correctly to set the appearance of a view (I do not think the capability to do what I want to do is currently in B4A). Below is the sub I put in a code module. I am very new to all of this so I appreciate your understanding if I am asking a stupid question.
The Android site I am looking at is ...
GradientDrawable | Android Developers
Thanks.
The Android site I am looking at is ...
GradientDrawable | Android Developers
Thanks.
B4X:
Sub GetPanelFormat(pnl As Panel, pnlType As String)
Dim gd As GradientDrawable
Dim rfl1 As Reflector
Dim arColor(2) As Int
Select pnlType
Case "input"
arColor(0) = Colors.Blue
arColor(1) = Colors.White
gd.Initialize("LEFT_RIGHT",arColor )
gd.CornerRadius = 20dip
rfl1.Target = gd
' THEN, CHANGE THE GRADIENT TYPE FROM THE DEFAULT LINEAR TO RECTANGLE
' EXAMPLES of Reflector.RunMethod attemps that failed. Error message something like "NO METHOD FOUND".
' rfl1.RunMethod("setGradientType(RECTANGLE)")
' rfl1.RunMethod("GradientDrawable.setGradientType(RECTANGLE)")
' rfl1.RunMethod("android.graphics.drawable.GradientDrawable$setGradientType(RECTANGLE)")
' rfl1.RunMethod("android.graphics.drawable.GradientDrawable.setGradientType(RECTANGLE)")
' rfl1.RunMethod("android.graphics.drawable.setGradientType(RECTANGLE)")
' I picked "RunMethod" as the best way to implement a GET or SET method but I may be way off.
' I mostly expect that I do not understand how to read Andrew's documentation and I am messing up the
' parameters (i.e., "method as String" parameter).
pnl.Background = gd
Case "help"
arColor(0) = Colors.Red
arColor(1) = Colors.White
gd.Initialize("LEFT_RIGHT",arColor )
gd.CornerRadius = 10dip
rfl1.Target = gd
' CHANGE THE GRADIENT TYPE FROM THE DEFAULT LINEAR TO RECTANGLE
pnl.Background = gd
Case Else
pnl.Color = Colors.Black
End Select
End Sub