Chris Guanzon Active Member Licensed User Longtime User Mar 4, 2021 #1 Hello, How to set swiftbutton gradient background color. I tried this code B4X: SwiftButton1.xLBL.SetColorAndBorder(gradient, 0dip, 0x00FFFFFF, 50dip) and this B4X: SwiftButton1.mBase.SetColorAndBorder(gradient, 0dip, 0x00FFFFFF, 50dip) but got this error. B4X: java.lang.NumberFormatException: For input string: "(GradientDrawable) android.graphics.drawable.GradientDrawable@357f15c" This is the code I used for gradient B4X: Dim gradient As GradientDrawable Dim clrs(2) As Int clrs(0) = 0xFF3F51B5 clrs(1) = 0xFF9C27B0 gradient.Initialize("TR_BL",clrs) gradient.CornerRadius = 50dip
Hello, How to set swiftbutton gradient background color. I tried this code B4X: SwiftButton1.xLBL.SetColorAndBorder(gradient, 0dip, 0x00FFFFFF, 50dip) and this B4X: SwiftButton1.mBase.SetColorAndBorder(gradient, 0dip, 0x00FFFFFF, 50dip) but got this error. B4X: java.lang.NumberFormatException: For input string: "(GradientDrawable) android.graphics.drawable.GradientDrawable@357f15c" This is the code I used for gradient B4X: Dim gradient As GradientDrawable Dim clrs(2) As Int clrs(0) = 0xFF3F51B5 clrs(1) = 0xFF9C27B0 gradient.Initialize("TR_BL",clrs) gradient.CornerRadius = 50dip
DonManfred Expert Licensed User Longtime User Mar 4, 2021 #2 p.SetColorAndBorder(0xaa111111, 2dip, 0xFFFFFFFF, 5dip) Look at the 1st parameter. You can not pass a Drawable where it expects an Int. Upvote 0
p.SetColorAndBorder(0xaa111111, 2dip, 0xFFFFFFFF, 5dip) Look at the 1st parameter. You can not pass a Drawable where it expects an Int.
Chris Guanzon Active Member Licensed User Longtime User Mar 4, 2021 #3 DonManfred said: p.SetColorAndBorder(0xaa111111, 2dip, 0xFFFFFFFF, 5dip) Look at the 1st parameter. You can not pass a Drawable where it expects an Int. Click to expand... how can I pass a drawable in swiftbutton? It doesn't have a background property like in the button. Upvote 0
DonManfred said: p.SetColorAndBorder(0xaa111111, 2dip, 0xFFFFFFFF, 5dip) Look at the 1st parameter. You can not pass a Drawable where it expects an Int. Click to expand... how can I pass a drawable in swiftbutton? It doesn't have a background property like in the button.
Erel B4X founder Staff member Licensed User Longtime User Mar 4, 2021 #4 Not possible without modifying the source code. Upvote 0
Chris Guanzon Active Member Licensed User Longtime User Mar 4, 2021 #5 Erel said: Not possible without modifying the source code. Click to expand... ok, ? I wish we can add a gradient color. Anyway, thank you very much. Upvote 0
Erel said: Not possible without modifying the source code. Click to expand... ok, ? I wish we can add a gradient color. Anyway, thank you very much.