French toogle button

tigas

Member
Licensed User
Longtime User
bonjour à tous
Est-il possible de rendre l'activation du Togglebutton plus visible
j'obtiens juste un petit souligné vert
Merci d'avance..
 

klaus

Expert
Licensed User
Longtime User
Oui.

Avec deux couleurs:
B4X:
    Private cd1, cd2 As ColorDrawable
    cd1.Initialize(xui.Color_Green, 5dip)
    cd2.Initialize(xui.Color_Red, 5dip)
    Private sd2 As StateListDrawable
    sd2.Initialize
    sd2.AddState(sd2.State_Checked, cd1)
    sd2.AddState(sd2.State_Unchecked, cd2)
    btnTest2.Background = sd2

Ou, avec deux images bitmap.

B4X:
    Private bd1, bd2 As BitmapDrawable
    Private bmp1, bmp2 As Bitmap
    Private sd1 As StateListDrawable
    bmp1.Initialize(File.DirAssets, "bmpChecked.bmp")
    bmp2.Initialize(File.DirAssets, "bmpUnchecked.bmp")
    bd1.Initialize(bmp1)
    bd2.Initialize(bmp2)
    sd1.Initialize
    sd1.AddState(sd1.State_Checked, bd1)
    sd1.AddState(sd1.State_Unchecked, bd2)
    btnTest1.Background = sd1
 
Top