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
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.
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:
B4X:
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.
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.
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).
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).
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.