About the sub-object position (coordinates) problem
What LVGL version are you using?
V8.3.6
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
You have to set all the margins, paddings to zero as well as the border width and outline width. I don’t remember which one is exactly causing it but one of those is. I set up a style and add the style to every widget I create to make sure the positioning is as it should be.
Thank you very much for your reply, I will try your suggestion. But if I change to the following code the position of btn and btn1 is completely correct.
The buttons are not what is causing the problem. it’s the “cont” you have that sits between the screen and the buttons that is. That is the thing you need to remove any of the margins and border widths from.
if your display has a resolution of 480 x 320 then your buttons are not going to be in the corners of the screen. That is because the “cont” has a size that is 30 pixel less in width than the screen is. You are using the bottom mid as the alignment point which means align the bottom of the child object to the bottom of the parent object so the vertical center line for both the child aand the parent are also in alignment. That means the edges of the “cont” object are going to be 15 pixels in from the edges of the display. Your buttons if aligned to the bottom left and the bottom right will align to the bottom corners of their parent. In the original code that is going to be the “cont” object. So if you are expecting the buttons to be in the corners of the display then you need to set the width of the “cont” object to be the same as the display.