now I use xcustomlistview; I tried to use this Sub:
B4X:
Sub SetScrollbarColor(sv As ScrollView, clr As Int)
Dim r As Reflector
r.Target = sv
r.Target = r.GetField("mScrollCache")
r.Target = r.GetField("scrollBar")
Dim cd As ColorDrawable
cd.Initialize(clr, 5dip)
r.RunMethod4("setVerticalThumbDrawable", Array(cd), Array As String("android.graphics.drawable.Drawable"))
End Sub
but I get the following error on line 5 ( r.Target = r.GetField("scrollBar") :
B4X:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
at anywheresoftware.b4a.agraham.reflection.Reflection.runmethod(Reflection.java:205)
at anywheresoftware.b4a.agraham.reflection.Reflection.RunMethod4(Reflection.java:857)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.oilcontrol.ash.addcar.afterFirstLayout(addcar.java:104)
at com.oilcontrol.ash.addcar.access$000(addcar.java:17)
at com.oilcontrol.ash.addcar$WaitForLayout.run(addcar.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6198)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
This code uses reflection to change the ScrollView scroll bar color: Sub SetScrollbarColor(sv As ScrollView, clr As Int) Dim r As Reflector r.Target = sv r.Target = r.GetField("mScrollCache") r.Target = r.GetField("scrollBar") Dim cd As ColorDrawable cd.Initialize(clr...
Subject: Routines to managing ScrollView properties. Sub: setVerticalScrollBarEnabled Description: Displays or hides the vertical ScrollBar of the ScrollView. 'displays or hides the VerticalScrollBar of the ScrollView Sub setVerticalScrollBarEnabled(v As View, Enabled As Boolean) Dim jo = v...