Android Question Swiftbutton Gradient Color

Chris Guanzon

Active Member
Licensed User
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
p.SetColorAndBorder(0xaa111111, 2dip, 0xFFFFFFFF, 5dip)

Look at the 1st parameter. You can not pass a Drawable where it expects an Int.
 
Upvote 0
Top