ciginfo Well-Known Member Licensed User Longtime User Aug 12, 2012 #1 Hello Why when I use "TableHost" an object with 100% of x in a layout exceeds the right edge. I am forced to program in the layout an object with 95% of x for full view when TableHost is used. thank you Attachments Av1.png 38.6 KB · Views: 495 Av2.png 84.7 KB · Views: 463
Hello Why when I use "TableHost" an object with 100% of x in a layout exceeds the right edge. I am forced to program in the layout an object with 95% of x for full view when TableHost is used. thank you
Informatix Expert Licensed User Longtime User Aug 19, 2012 #21 I'm surprised because I was used to set my views in TabHosts to 100%x minus a margin. I have some real examples where 100%x only is too wide. I don't understand why (I probably made something wrong somewhere) and since I replace these values now by -1, all is ok. Upvote 0
I'm surprised because I was used to set my views in TabHosts to 100%x minus a margin. I have some real examples where 100%x only is too wide. I don't understand why (I probably made something wrong somewhere) and since I replace these values now by -1, all is ok.
Erel B4X founder Staff member Licensed User Longtime User Aug 19, 2012 #22 When you load the layout file with AddTab, the designer script 100%x is relative to the TabHost size. Upvote 0
When you load the layout file with AddTab, the designer script 100%x is relative to the TabHost size.
Informatix Expert Licensed User Longtime User Aug 19, 2012 #23 The proof: With that code, I get the first screenshot: Code: Dim lbl As Label lbl.Initialize("") Dim cd As ColorDrawable cd.Initialize(Colors.Blue, 10dip) lbl.Background = cd pnlAudio.AddView(lbl, 0, 0, 100%x, 30dip) With the following code (I just replaced 100%x by -1), I get the second screenshot: Code: Dim lbl As Label lbl.Initialize("") Dim cd As ColorDrawable cd.Initialize(Colors.Blue, 10dip) lbl.Background = cd pnlAudio.AddView(lbl, 0, 0, -1, 30dip) The pnlAudio width is automatically sized by the TabHost when I initialize it. And I don't change this width after that. This example is a very common TabHost use, I think. Attachments img1.jpg 16.6 KB · Views: 442 img2.jpg 15.6 KB · Views: 492 Upvote 0
The proof: With that code, I get the first screenshot: Code: Dim lbl As Label lbl.Initialize("") Dim cd As ColorDrawable cd.Initialize(Colors.Blue, 10dip) lbl.Background = cd pnlAudio.AddView(lbl, 0, 0, 100%x, 30dip) With the following code (I just replaced 100%x by -1), I get the second screenshot: Code: Dim lbl As Label lbl.Initialize("") Dim cd As ColorDrawable cd.Initialize(Colors.Blue, 10dip) lbl.Background = cd pnlAudio.AddView(lbl, 0, 0, -1, 30dip) The pnlAudio width is automatically sized by the TabHost when I initialize it. And I don't change this width after that. This example is a very common TabHost use, I think.
Erel B4X founder Staff member Licensed User Longtime User Aug 19, 2012 #24 No one said that -1 will not work. Upvote 0
Informatix Expert Licensed User Longtime User Aug 19, 2012 #25 Erel said: No one said that -1 will not work. Click to expand... Ok, but why, in my example, 100%x does not work ? That should give exactly the same result as -1. I checked the widths (I used the "getWidth" method) and here are the results: pnlAudio width (with both solutions) = 452 lbl width (100%x) = 480 lbl width (-1) = 452 It seems there's a bug with 100%x in that particular case. Upvote 0
Erel said: No one said that -1 will not work. Click to expand... Ok, but why, in my example, 100%x does not work ? That should give exactly the same result as -1. I checked the widths (I used the "getWidth" method) and here are the results: pnlAudio width (with both solutions) = 452 lbl width (100%x) = 480 lbl width (-1) = 452 It seems there's a bug with 100%x in that particular case.
Erel B4X founder Staff member Licensed User Longtime User Aug 19, 2012 #26 100%x always returns the Activity width. Only in the designer script, the percentage is related to the main parent (Activity when you call Activity.LoadLayout, Panel when you call Panel.LoadLayout or TabHost when you call TabHost.AddTab). Upvote 0
100%x always returns the Activity width. Only in the designer script, the percentage is related to the main parent (Activity when you call Activity.LoadLayout, Panel when you call Panel.LoadLayout or TabHost when you call TabHost.AddTab).
Informatix Expert Licensed User Longtime User Aug 19, 2012 #27 Erel said: 100%x always returns the Activity width. Only in the designer script, the percentage is related to the main parent (Activity when you call Activity.LoadLayout, Panel when you call Panel.LoadLayout or TabHost when you call TabHost.AddTab). Click to expand... Do you realize you're working on a sunday ? You should go to the beach, enjoy the sun, repaint your shutters, hack the Pentagon servers, behead some elves with an axe, but ... working ? You're crazy Anyway, thanks for the info. I wasn't aware of the difference. Upvote 0
Erel said: 100%x always returns the Activity width. Only in the designer script, the percentage is related to the main parent (Activity when you call Activity.LoadLayout, Panel when you call Panel.LoadLayout or TabHost when you call TabHost.AddTab). Click to expand... Do you realize you're working on a sunday ? You should go to the beach, enjoy the sun, repaint your shutters, hack the Pentagon servers, behead some elves with an axe, but ... working ? You're crazy Anyway, thanks for the info. I wasn't aware of the difference.
Erel B4X founder Staff member Licensed User Longtime User Aug 19, 2012 #28 You're crazy Click to expand... I'm not saying that I'm not... However the weekend days here are Friday and Saturday Upvote 0
You're crazy Click to expand... I'm not saying that I'm not... However the weekend days here are Friday and Saturday