Sub ButtonGradient(LightColor As Int, DarkColor As Int) As StateListDrawable
Dim ref As Reflector
' Define a GradientDrawable for Enabled state
Dim gdwEnabled As GradientDrawable
gdwEnabled.Initialize("TOP_BOTTOM", Array As Int(LightColor, Colors.White, DarkColor))
gdwEnabled.CornerRadius = 15
' Define a GradientDrawable for Pressed state
Dim gdwPressed As GradientDrawable
gdwPressed.Initialize("TOP_BOTTOM",Array As Int(DarkColor, DarkColor, Colors.White, LightColor))
ref.Target = gdwPressed
ref.RunMethod4("setCornerRadii", Array As Object(Array As Float(10,15,10,15,10,15,10,15)), Array As String("[F"))
' Define a GradientDrawable for Disabled state
Dim gdwDisabled As GradientDrawable
gdwDisabled.Initialize("TOP_BOTTOM", Array As Int(Colors.LightGray, Colors.DarkGray))
gdwDisabled.CornerRadius = 20
' Define a StateListDrawable
Dim stdGradient As StateListDrawable
stdGradient.Initialize
stdGradient.AddState2(Array As Int(stdGradient.State_enabled, -stdGradient.State_Pressed), gdwEnabled)
stdGradient.AddState(stdGradient.State_Pressed, gdwPressed)
stdGradient.AddState(stdGradient.State_Disabled, gdwDisabled)
Return stdGradient
End Sub