Border Button

Slacker

Active Member
Licensed User
Longtime User
Hello Folks, question is pretty simple:

How can i set quickly a rounded border in a button ? I have used this simply routine to set Gradient ...if i want a rounded border too ?

B4X:
Sub DrawButtonGraphic(pCol1 As Int, pCol2 As Int)
   Dim canvas1 As Canvas
   Dim Clrs(2) As Int
   canvas1.Initialize(LoginBt)
   Dim r As Rect
   Dim btnRect As Rect

   btnRect.Initialize(0, 0, LoginBt.Width, LoginBt.Height)
   
   Clrs(0) = pCol1
   Clrs(1) = pCol2
   GradientButton.Initialize("BOTTOM_TOP", Clrs)
   GradientButton.CornerRadius = 6
   canvas1.DrawDrawable(GradientButton, btnRect)
   
   
   Activity.Invalidate()

End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can set the corners in the visual designer:
SS-2012-10-17_10.25.28.png
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
Sorry, i was meaning an extra rounded border OF A DIFFERENT COLOR....i guess i can use an extra rectangle, with larger dimensions as ColorDrawable...
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
That's what i looking for, thanks a lot !:icon_clap: ;)
 
Upvote 0
Top