You have to use DynamicComponents extension and ComponentTools extension (it’s better than component built-in kodular).
Move your labels (DynamicComponents - MoveBlock) to your cardview.
After the movement, your labels should appear at the top of your cardview.
Set your labels Y postition (ComponentTools - SetY block) to any % of your CardView height. To do it getHeight of your CardView and multiply it by the % you want the height of your labels.
It will work correctly on any width, height and resolution of different screens.
This helped me a lot, but now I can no longer get the “clickable” favorite button.
And I was taking a look, the heart stayed perfect when I used the “MoveBlock”, they stayed on the top left. I saw that I had SetX which are for the horizontals, now I have to figure out a value that catches on all mobiles.
You don’t need to find any value . Just get the width of your image. GetX (ComponentTools block) is the X position of the left side of your image. GetRightPosition is the X position of the right side of your image.
So you just need to set X of your label according to the right position of your image minus value you would like to be in % of the width of the image. (Image width is GetRightPosition - GetY).
If you will operate on width and percentage of width, everything will be placed the same as in your actual screen.
Probably you set your CardView to FullClickable. As moved label is the child object of CardView you won’t be able to click it as it is set FullClickable to true.
Deleted “Picture”: “{image}” property from schema. It caused lag at startup.
Changed position of label (discount) in Schema .json file. It’s a first component created in cardview.
Added property “Clickable”: true to Label (discount).
Added AsyncProc extension. To manipulate position of your objects you have to make a little delay after creation of them. AsyncProc extension makes possible to wait before procedure starts on different thread (doesn’t freeze your app).
Added logic to set Label (discount) at position you want (it will work for any length of the text of your label, besides the one exceding the width of the image). There’s a multiplier at the end of blocks you can use to position object as you want.
If you want to overlay components (image under the label), it’s safe to have the label created at first (it’s higher in “hierarchy”), before the image, so if you move label on image it’s visible (component tools movemets).
In that case, dynamic components make the overlay works correctly (by moving component to cardview), so accept it as an useless change .