My main layout is just a panel centered on the screen as shown below:
And the content layout has the following arrangement:
Now, when I anchor Button1 to the bottom of the content layout, this is what I get as the end result:
And when I anchor it to the top, I rather get the following image as the output:
It seems the anchor is doing exactly opposite what I am expecting. Please is this a bug or I still haven't understood the concept of layouts well? Thank you.
Thank you Sir. I am very pleased to hear from you. I will switch to B4XPages as soon as possible....in that case I think there is no need to to upload the project. Thank you once again.
I think your anchor expectations are wrong. I assume that you want the SIGN UP button to be positioned in some fixed way relative to the other controls which are all anchored to the top, so the SIGN UP button should be top anchored as well, which in your example gives exactly the expected relative layout. I assume that layout is loaded into the panel in which case all looks well to me. What were you expecting to see?
I think your anchor expectations are wrong. I assume that you want the SIGN UP button to be positioned in some fixed way relative to the other controls
In that case the button is wrongly placed in the layout. It should be be placed down at the bottom of the layout when anchored to the bottom with the number of pixels from the bottom being the required offset from the bottom of the panel.
I am attaching a second version that is only slightly better.
Views anchored at the top are actually automatically moved lower; it seems that this is due to the anchoring of the Button (on bottom).
I was forced to re-color the panel after loading it, despite the transparency of the content layout.
I don't think they are and it's nothing to do with the Button anchoring. You haven't put any text in Label1 so you can't see it. It is still at the top. The position of the others are scaled to absolute pixels by AutoScaleAll in the layout and then according to the dip scale value of the device as returned by GetLayoutValues. Comment out AutoScaleAll in the layout and then check the Top values. You will see they are the values in the layout multiplied by the device scale.
It's late and I need to dash for dinner but I think the Panel adopts the layout colour when it is loaded so it becomes transparent to the underlying panel that is B4XMainPage and has the MainPage layout loaded into it. Give the MainPage layout a solid background colour and you will see it.
It's late and I need to dash for dinner but I think the Panel adopts the layout colour when it is loaded so it becomes transparent to the underlying panel that is B4XMainPage and has the MainPage layout loaded into it. Give the MainPage layout a solid background colour and you will see it.
I think your anchor expectations are wrong. I assume that you want the SIGN UP button to be positioned in some fixed way relative to the other controls which are all anchored to the top, so the SIGN UP button should be top anchored as well, which in your example gives exactly the expected relative layout. I assume that layout is loaded into the panel in which case all looks well to me. What were you expecting to see?