Colored Buttons

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel

I am tried to create buttons programmatically and I wondering if you can guide me to achieve the followings.
By default, when a button is created, buttons look nice with round angles and gradient ( I am not sure if I am using the proper terminology ). Basically not made it out of one color ( more like Grey mixed with whitish glow ).

If I assign a back color to the button, it looks like a flat and rectangular square.
In order for me to work around the issue I used the following code

Dim bkColor As ColorDrawable

bkColor.Initialize(Colors.RGB( strBackColorList(0), strBackColorList(1), strBackColorList(2)), 10dip)
cdChecked.Initialize(Colors.RGB( strForeColorList(0), strForeColorList(1), strForeColorList(2)), 10dip)

sld.Initialize

sld.AddState(sld.State_Pressed, cdChecked)
sld.AddCatchAllState(bkColor)

btnButton.Background = sld


This seems to solve the appearance problem, whoever I do end up with a one solid color button ( rounded nicely ).
Is there a way I can achieve that glow/gradient mix.

Please advise

By the way, what a fantastic job you have done on this.

Thank You
 
Top