Android Question ImageView Shadow/Glow

Yeskay

Member
Licensed User
i want to know how to add shadow to an imageview.
i tried to add shadow to label with the following code and it is working fine. but the same way it is not working for imageview
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
    SetTextShadow(lblFTitle1,5,3,3,Colors.Black)
End Sub

Sub SetTextShadow(pView As View, pRadius As Float, pDx As Float, pDy As Float, pColor As Int)
    Dim ref As Reflector
   
    ref.Target = pView
    ref.RunMethod4("setShadowLayer", Array As Object(pRadius, pDx, pDy, pColor), Array As String("java.lang.float", "java.lang.float", "java.lang.float", "java.lang.int"))
End Sub
when i using this same method for imageview, am receiving the following error
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_settextshadow (java line: 707)
java.lang.NoSuchMethodException: setShadowLayer [float, float, float, int]
    at java.lang.Class.getMethod(Class.java:2068)
    at java.lang.Class.getDeclaredMethod(Class.java:2047)
    at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:214)
    at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod4(Reflection.java:857)
    at in.cloud6.news4g.main._settextshadow(main.java:707)
    at in.cloud6.news4g.main._activity_create(main.java:379)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
    at in.cloud6.news4g.main.afterFirstLayout(main.java:104)
    at in.cloud6.news4g.main.access$000(main.java:17)
    at in.cloud6.news4g.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:874)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:198)
    at android.app.ActivityThread.main(ActivityThread.java:6729)
    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)
 
Top