Android Question Edittext Enabled

aviario

Active Member
Licensed User
Longtime User
Hi, is there any way that when we put a EditExt enabled = true the color is white instead of gray?
thanks
 

aviario

Active Member
Licensed User
Longtime User
Hi, I need to EditText because depending on the configuration of the application can be EditExt enabled = true or false so I can not use label

thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code (requires Reflection library):
B4X:
Sub SetEditTextBackground(et As EditText)
   Dim sd1 As StateListDrawable = et.Background
   Dim r As Reflector
   r.Target = sd1
   Dim index As Int = r.RunMethod4("getStateDrawableIndex", _
     Array As Object(Array As Int(sd1.State_Enabled)), _
     Array As String("[I"))
   Log(index)
   et.Background = r.RunMethod2("getStateDrawable", index, "java.lang.int")
   et.TextColor = et.TextColor
End Sub
 
Upvote 0
Top