D dieterp Active Member Licensed User Longtime User Nov 23, 2017 #1 I have a transparent .png file that I use for an image on a button (An undo arrow). In B4A and B4I, the image will make the button transparent too. When I do the same in B4J though I get a greyish color background for the image. Is it possible to get the button to also become transparent in B4J?
I have a transparent .png file that I use for an image on a button (An undo arrow). In B4A and B4I, the image will make the button transparent too. When I do the same in B4J though I get a greyish color background for the image. Is it possible to get the button to also become transparent in B4J?
D dieterp Active Member Licensed User Longtime User Nov 24, 2017 #2 I have tried playing around with the alpha. That makes the whole button eventually disappear (alpha = 0) including the image that is on the button. Setting alpha = 0.5 just gives me a faded button but the background is still there Upvote 0
I have tried playing around with the alpha. That makes the whole button eventually disappear (alpha = 0) including the image that is on the button. Setting alpha = 0.5 just gives me a faded button but the background is still there
Erel B4X founder Staff member Licensed User Longtime User Nov 24, 2017 #3 You can use a Pane instead of a Button. Another option: https://www.b4x.com/android/forum/threads/button-with-image.53662/#post-336326 Upvote 0
You can use a Pane instead of a Button. Another option: https://www.b4x.com/android/forum/threads/button-with-image.53662/#post-336326
D dieterp Active Member Licensed User Longtime User Nov 24, 2017 #4 Thanks Erel. Is the only solution to set it up through code and not the designer? I have quite a lot of buttons that use transparent images in the app Upvote 0
Thanks Erel. Is the only solution to set it up through code and not the designer? I have quite a lot of buttons that use transparent images in the app
stevel05 Expert Licensed User Longtime User Nov 24, 2017 #5 Try setting the Buttons background color to transparent in the designer extra-css field : -fx-background-color: 0000; or you can use CSSUtils to do it in code. Upvote 0
Try setting the Buttons background color to transparent in the designer extra-css field : -fx-background-color: 0000; or you can use CSSUtils to do it in code.
D dieterp Active Member Licensed User Longtime User Nov 25, 2017 #6 Hi Steve. That has done the trick. Much appreciated! Upvote 0
D dieterp Active Member Licensed User Longtime User Nov 27, 2017 #7 Just one question on the solution above; I get a warning message (Listed below) in the logs. Is this something I should be concerned about or can it be ignored? Nov 27, 2017 10:35:58 AM javafx.scene.CssStyleHelper calculateValue WARNING: Caught 'java.lang.ClassCastException: java.lang.Double cannot be cast to javafx.scene.paint.Paint' while converting value for '-fx-background-color' from inline style on Button@ff46c6[styleClass=button]'' Upvote 0
Just one question on the solution above; I get a warning message (Listed below) in the logs. Is this something I should be concerned about or can it be ignored? Nov 27, 2017 10:35:58 AM javafx.scene.CssStyleHelper calculateValue WARNING: Caught 'java.lang.ClassCastException: java.lang.Double cannot be cast to javafx.scene.paint.Paint' while converting value for '-fx-background-color' from inline style on Button@ff46c6[styleClass=button]''
Erel B4X founder Staff member Licensed User Longtime User Nov 27, 2017 #8 Change it to: -fx-background-color: rgba(0, 0, 0, 0.00); Upvote 0