Android Question Funny button

grafsoft

Well-Known Member
Licensed User
Longtime User
This button is cut off at the bottom. It should be round.

On most devices it is OK, on some not, on some it is even cut in half.

I use this code to set a button containing a graphic symbol on a blue circle:

B4X:
Sub setbackground (b As Button, bb As Button, siz As Int, dist As Int, xkorr As Int, ykorr As Int)
   Dim rad As Int = b.Width
   Dim c As Int = Main.a400color
   bb.color=c
   Dim cd As ColorDrawable
   cd.Initialize (c,rad)
   bb.Background=cd
   bb.Left=b.Left-dist+xkorr
   bb.Top=b.Top-dist+ykorr
   bb.Width=siz
   bb.Height=bb.Width
   bb.Visible=True
   b.Visible=True
   b.BringToFront
End Sub
 

Attachments

  • Screenshot_20160126-183441.jpg
    Screenshot_20160126-183441.jpg
    136.1 KB · Views: 180

sorex

Expert
Licensed User
Longtime User
did you wrap that button into its own panel? it seems that the panel's size is too small if that is the case.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
Useually to get a circle with a colordrawable I use half the width of the view as radius because it is the radius of the corner. Try with half width.
Also - don't change the width after assignment of the drawable.
 
Upvote 0
Top