Android Question Button with small image on left side


Well-Known Member
Licensed User
Longtime User

I want to adapt below code to add a small image to a button (left side). Don't want to use nine patch right now because don't want to graphical design my buttons.

Sub setButtonTheme(Btn As Button, Pressed As Int, Enabled As Int, Disabled As Int, CornerRadius As Int,TextColor As Int,bHeight As Boolean )

Dim cdPressed, cdEnabled, cdDisabled As ColorDrawable
cdPressed.Initialize(Pressed, CornerRadius)
cdEnabled.Initialize(Enabled, CornerRadius)
cdDisabled.Initialize(Disabled, CornerRadius)
Dim sld As StateListDrawable
sld.AddState(sld.State_Pressed, cdPressed)
sld.AddState(sld.State_Enabled, cdEnabled)
sld.AddState(sld.State_Disabled, cdDisabled)
Btn.TextColor = TextColor
If bHeight=True Then
Btn.Height = 40dip
End If
Btn.Background = sld

End Sub



Well-Known Member
Licensed User
Longtime User
BitMapDrawable means I need to create full graphical buttons right? I just want to create styled buttons with an icon left. Don't want to create my buttons in a graphics editor.
Upvote 0