B4J Question change colour of button [Solved]

Peter Lewis

Active Member
Licensed User
Longtime User
Hi All

I am looking to change the button background of a button to either green or Red depending on when the button is clicked.

In the clicked code I can put the statement there but there are no color options i can see when I put the button. code , only a button text color appears

Any ideas ?

Thank you
 

drgottjr

Expert
Licensed User
Longtime User
in b4a there is a lovely thing called state drawable the button changes background (even an image, if you use one for a button's background) on tap and on release.
i'm not sure if the same thing exists in b4j. i could only find this see what you can dig up.
 
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
in b4a there is a lovely thing called state drawable the button changes background (even an image, if you use one for a button's background) on tap and on release.
i'm not sure if the same thing exists in b4j. i could only find this see what you can dig up.
I found that a few hours ago but it would not work due to missing library, do you know which lib it is , I clicked on a lot but did not make any difference. B4J
 
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
With SwiftButton you should be able to do it.
I have tried looking over the forums with the structure of SwiftButton, I also downloaded the examples and No where I could find has the button color change structure.

I am sure it can do it . Is there any Manual on SwiftButton

Nothing I have tried works. Anexample

B4X:
    btn1.xLBL.Color.XUI.Color_Red
 
Upvote 0
Top