Dennis Glowack Member Licensed User Jul 7, 2020 #1 I've noticed that if I programmatically change the button color of a button that is designed with rounded corners, that the corner rounding reverts to square corners. Is there any way to stop this? My buttons were designed to use ColorDrawable in the Designer. Thanks Last edited: Jul 7, 2020
I've noticed that if I programmatically change the button color of a button that is designed with rounded corners, that the corner rounding reverts to square corners. Is there any way to stop this? My buttons were designed to use ColorDrawable in the Designer. Thanks
M Mahares Expert Licensed User Longtime User Jul 7, 2020 #2 Dennis Glowack said: My buttons were designed to use ColorDrawable Click to expand... You can re-generate the colordrawable programmatically with this code: Code: Copy Dim cd As ColorDrawable cd.Initialize(Colors.Red, 15dip) 'you can also use Initialize2 with more parameters Button1.Background =cd Button1. text ="Dennis" Upvote 0
Dennis Glowack said: My buttons were designed to use ColorDrawable Click to expand... You can re-generate the colordrawable programmatically with this code: Code: Copy Dim cd As ColorDrawable cd.Initialize(Colors.Red, 15dip) 'you can also use Initialize2 with more parameters Button1.Background =cd Button1. text ="Dennis"
Erel B4X founder Staff member Licensed User Longtime User Jul 8, 2020 #3 You should use StateListDrawable with buttons: https://www.b4x.com/search?query=StateListDrawable Another option is to use SwiftButton from XUI Views. Upvote 0
You should use StateListDrawable with buttons: https://www.b4x.com/search?query=StateListDrawable Another option is to use SwiftButton from XUI Views.
Dennis Glowack Member Licensed User Jul 8, 2020 #4 Mahares said: You can re-generate the colordrawable programmatically with this code: Code: Copy Dim cd As ColorDrawable cd.Initialize(Colors.Red, 15dip) 'you can also use Initialize2 with more parameters Button1.Background =cd Button1. text ="Dennis" Click to expand... Thanks, I didn't know I could do this. It worked. Upvote 0
Mahares said: You can re-generate the colordrawable programmatically with this code: Code: Copy Dim cd As ColorDrawable cd.Initialize(Colors.Red, 15dip) 'you can also use Initialize2 with more parameters Button1.Background =cd Button1. text ="Dennis" Click to expand... Thanks, I didn't know I could do this. It worked.