Android Question Cross platform ToggleButton

Mattyeux

Member
Licensed User
Hi,

I'm looking for a ToggleButton that I can use in B4A and B4I.
I want a button with embedded text that's why I don't want to use B4XSwitch.

Is threre a view for that or any way to add text in the B4XSwitch inside the switch

Regards
 

Mahares

Expert
Licensed User
any way to add text in the B4XSwitch inside the switch
As you can see from Erel's post in the below thread, you cannot show text inside B4XSwitch.
However, you know you can add a small label above or below the switch that can show the status; you can even embellish it using CSBuilder:
B4X:
Sub B4XSwitch_ValueChanged (Value As Boolean)
     If Value Then 
        Label1.Text="ON"
        Label1.TextColor =XUI.Color_Green
     Else 
        Label1.Text="OFF"
        Label1.TextColor =XUI.Color_Red
    End If
 
Upvote 0

Mattyeux

Member
Licensed User
I post an example to get your advice

Here is the current behavior in B4A (see attached files)
When you select the orange ToggleButton, you can then select one of the buttons below and it colors it orange.
If you select the green ToggleButton, the orange is deselected. We can then select another button below to apply the green border to it.

Depending on the ToggleButton that we have selected the actions are different
it behaves like a group of radio buttons but I don't want a circle with the text next to it but rather buttons with a selected state

which cross-platform view would you recommend me to use?
 

Attachments

  • Capture.PNG
    Capture.PNG
    20.1 KB · Views: 70
  • Capture2.PNG
    Capture2.PNG
    20.4 KB · Views: 66
Upvote 0
Top