Hey,
So I'm struggling to understand why I can not right-align views within a panel.
I have a panel (big yellow rectangle) and inside I have several other views. The panel (pnlLevelInfo) width is set with designer script:
Inside this panel I have a label (lblTimeSLowest). Its width is set to 50% of the panel width and in designer script I set it to right align to the panel:
However, the right of the lblTimeSlowest is actually against the right side of the whole screen i.e as if in the designer I'd set horizontal align to right and distance to zero. I don't understand why. It's as if pnlLevelInfo.Right is giving the x coordinate of the far right of the screen even though its right side is 15dip in from the right.
Also, I tried to make some labels the same width as the panel by using horizontal anchor: both and setting left and right to zero for the lblInstructions illustrated above. The left side correctly aligns to the left of the panel but the right of the label does not touch the right side of the panel. It's the same with the other labels. Its as if there is hidden right padding inside the panel!
Anyway, I know I can get around this by specifying specific right positions of these views in dip rather than referencing pnlLevelInfo.Right but I am stubborn an need to understand what is going on here.
It's rather frustrating that I can't work it out!
So I'm struggling to understand why I can not right-align views within a panel.
I have a panel (big yellow rectangle) and inside I have several other views. The panel (pnlLevelInfo) width is set with designer script:
B4X:
pnlLevelInfo.Left = 15dip
pnlLevelInfo.Width = 100%x - 30dip
Inside this panel I have a label (lblTimeSLowest). Its width is set to 50% of the panel width and in designer script I set it to right align to the panel:
B4X:
lblTimeSlowest.Right = pnlLevelInfo.Right
However, the right of the lblTimeSlowest is actually against the right side of the whole screen i.e as if in the designer I'd set horizontal align to right and distance to zero. I don't understand why. It's as if pnlLevelInfo.Right is giving the x coordinate of the far right of the screen even though its right side is 15dip in from the right.
Also, I tried to make some labels the same width as the panel by using horizontal anchor: both and setting left and right to zero for the lblInstructions illustrated above. The left side correctly aligns to the left of the panel but the right of the label does not touch the right side of the panel. It's the same with the other labels. Its as if there is hidden right padding inside the panel!
Anyway, I know I can get around this by specifying specific right positions of these views in dip rather than referencing pnlLevelInfo.Right but I am stubborn an need to understand what is going on here.
It's rather frustrating that I can't work it out!