Android Question [B4X] B4XSwitch - Can I set the On/Off/Thumb Colors in code?

MrKim

Well-Known Member
Licensed User
Longtime User
That is the question. Let me explain my dilemma but it is what prompted another recent quest here about identifying labels. Here is what I am trying to do. I will have to seperate apps in the Play store. The only functional difference is that they will connect to different databases with identical schemas on the back end. Some users will actually download and use both apps. Some will not. For this reason I want to do two completely different color schemes for each app. The first one was not a problem as I was able to set the properties in the designer but for the second app I am having a devil of a time identifying all of the appropriate Views and elements to change. As per usual, 1% of the code is taking 99% of the time.

In this case, if I have to I can put two switches and switch them because there is only one but if there were a lot it would be a problem.
 

Mahares

Expert
Licensed User
Longtime User
Create two layout files with the two types of switches
Without changing the source or adding layouts, although I like the idea of layouts, what about something like this or is it tacky. The OP implies in his post possibly many cases, not just two.
B4X:
If Value Then
    sb.mBase.Color=xui.Color_Blue  
Else
    sb.mBase.Color=xui.Color_Red   
End If
You can also make the B4XSwitch more accented by adding padding to it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…