Change EditText Colors

1.Add:
#AdditionalJar: com.android.support:support-compat

2.
Sub SetBackgroundTintList(View As View,Active As Int, Enabled As Int)
   Dim States(2,1) As Int
   States(0,0) = 16842908     'Active
   States(1,0) = 16842910    'Enabled
   Dim Color(2) As Int = Array As Int(Active,Enabled)
   Dim CSL As JavaObject
   CSL.InitializeNewInstance("android.content.res.ColorStateList",Array As Object(States,Color))
   Dim jo As JavaObject
   jo.InitializeStatic("android.support.v4.view.ViewCompat")
   jo.RunMethod("setBackgroundTintList", Array(View, CSL))
End Sub

Example:
SetBackgroundTintList(EditText1, Colors.Red, 0xFF0020FF)

It will only be changed on Android 5+.

猜你喜欢

转载自www.cnblogs.com/moodsky/p/9099079.html