'###Gradient########################
Dim colsEnabled(2) As Int
colsEnabled(0) = Colors.RGB(60, 200, 80)
colsEnabled(1) = Colors.RGB(10, 100, 20)
' Define a GradientDrawable for Enabled state
Dim gdwEnabled As GradientDrawable
gdwEnabled.Initialize("TOP_BOTTOM",colsEnabled)
gdwEnabled.CornerRadius = 5
' Define two gradient colors for Pressed state
Dim colsPressed(2) As Int
colsPressed(1) = Colors.RGB(136, 136, 136)
colsPressed(0) = Colors.RGB(0, 0, 0)
' Define a GradientDrawable for Pressed state
Dim gdwPressed As GradientDrawable
gdwPressed.Initialize("TOP_BOTTOM",colsPressed)
gdwPressed.CornerRadius = 5
' Define a StateListDrawable
Dim stdGradient As StateListDrawable
stdGradient.Initialize
Dim states(2) As Int
states(0) = stdGradient.state_enabled
states(1) = -stdGradient.state_pressed
stdGradient.addState2(states, gdwEnabled)
Dim states(1) As Int
states(0) = stdGradient.state_pressed
stdGradient.addState2(states, gdwPressed)
'###################################
For I = 1 To 5
Dim Button1 As Button
Button1.Initialize("Button1")
Button1.Text = I
Button1.Background = stdGradient
Activity.AddView(Button1, 0dip, I * 50dip, 60dip, 40dip)
Next