Hi All,
Can you please give an example of using the Reflection object to change the color of part of an Edittext view. I think it is two parts, the 1st part is to set the part of the edit text as shown below:
Then the other part is to change the color of the selected text using the setTextColor method but I'm not sure of the syntax and parameters. What I've seen so far is
I know the latter has to change as I want the color changed for part of an edittext and not a label and triggered by code not the view being pressed.
Thanks
Can you please give an example of using the Reflection object to change the color of part of an Edittext view. I think it is two parts, the 1st part is to set the part of the edit text as shown below:
B4X:
Dim obj1 As Reflector
Dim ok As Boolean
obj1.target = disp(1)
obj1.runmethod3("setSelection", 0, "java.lang.int", 4, "java.lang.int")
Then the other part is to change the color of the selected text using the setTextColor method but I'm not sure of the syntax and parameters. What I've seen so far is
B4X:
Dimr As Reflector
Dim csl As Object
csl = r.CreateObject2("android.content.res.ColorStateList", _ Array As Object(states, clrs),Array As String("[[I","[I"))
r.Target = Label1
r.RunMethod4("setTextColor",Array As Object(csl), _ Array As String("android.content.res.ColorStateList"))
I know the latter has to change as I want the color changed for part of an edittext and not a label and triggered by code not the view being pressed.
Thanks