Jones Hone Active Member Licensed User Longtime User Feb 20, 2014 #1 I want no spacing between button and button on runtime. How should I do it? Thank you!
giga Well-Known Member Licensed User Longtime User Feb 20, 2014 #2 one option could be set the buttons in designer scripts with x and y Upvote 0
Jones Hone Active Member Licensed User Longtime User Feb 20, 2014 #3 Button1.Left=10dip Button1.Width=100dip Button2.Left=110dip Button2.Width=100dip I think: Button2.Left=Button1.Left+Button1.Width=110dip If I change: Button2.Left=102dip There will be no gap. Thank you very much! Is there a better way? Upvote 0
Button1.Left=10dip Button1.Width=100dip Button2.Left=110dip Button2.Width=100dip I think: Button2.Left=Button1.Left+Button1.Width=110dip If I change: Button2.Left=102dip There will be no gap. Thank you very much! Is there a better way?
giga Well-Known Member Licensed User Longtime User Feb 20, 2014 #4 I would use dip or %x and % y in designer either should work. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2014 #5 Use the SetPadding method I posted here to set the padding of the buttons to 0: http://www.b4x.com/android/forum/threads/padding-on-views.37252/#post-219562 Upvote 0
Use the SetPadding method I posted here to set the padding of the buttons to 0: http://www.b4x.com/android/forum/threads/padding-on-views.37252/#post-219562
Jones Hone Active Member Licensed User Longtime User Feb 20, 2014 #6 Hi Erel, I've tested that thread,But it set padding only, not set the gap between button and button. but,That is also I need. Anyway,Thank you very much. Upvote 0
Hi Erel, I've tested that thread,But it set padding only, not set the gap between button and button. but,That is also I need. Anyway,Thank you very much.
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2014 #7 Have you tried it with your layout? There is no "real" gap between the buttons in this case. The gap is caused by the padding. Upvote 0
Have you tried it with your layout? There is no "real" gap between the buttons in this case. The gap is caused by the padding.
Jones Hone Active Member Licensed User Longtime User Feb 20, 2014 #8 I'm not use layout! I created button by code. attached file is my test project. Can you help me. Thank you! Attachments MyButtonTestProject.zip MyButtonTestProject.zip 285 KB · Views: 370 Upvote 0
I'm not use layout! I created button by code. attached file is my test project. Can you help me. Thank you!
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2014 #9 Please use File - Export as zip when uploading projects. The problem is not with the padding. I was wrong ,the padding is not relevant here. The buttons default drawable includes a small gap. If you replace it by replacing the background then there is no gap: Code: Copy Sub Activity_Create(FirstTime As Boolean) For x = 0 To 10 For y = 0 To 10 Dim b As Button b.Initialize("b") b.Text = x & " " & y b.Color = Colors.Blue Activity.AddView(b, 40dip * x, 40dip * y, 40dip, 40dip) Next Next End Sub Upvote 0
Please use File - Export as zip when uploading projects. The problem is not with the padding. I was wrong ,the padding is not relevant here. The buttons default drawable includes a small gap. If you replace it by replacing the background then there is no gap: Code: Copy Sub Activity_Create(FirstTime As Boolean) For x = 0 To 10 For y = 0 To 10 Dim b As Button b.Initialize("b") b.Text = x & " " & y b.Color = Colors.Blue Activity.AddView(b, 40dip * x, 40dip * y, 40dip, 40dip) Next Next End Sub