Hello I like to set the Background of the Custom View to a GradiendDrawable by code like it is done by the Designer Properties.
What I'm doing wrong?
I tried this::
Dim ColorArray(2) As Int
ColorArray(0) = DisabledColor
ColorArray(1) = xui.Color_White
Dim dr As GradientDrawable
Dim Ori As String = mprops.Get("orientation")
dr.Initialize(Ori,ColorArray)
dr.CornerRadius = mprops.Get("gradradius")
Dim PNL As Panel = mBase
PNL.Background = dr
mBase=PNL
get this error on line PNL.Background = dr:
Error occurred on line: 249 (TDextPanel)
java.lang.ClassCastException: android.graphics.drawable.GradientDrawable cannot be cast to android.view.View
at anywheresoftware.b4a.objects.ViewWrapper.setBackground(ViewWrapper.java:105)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
What I'm doing wrong?