Hello. I have a problem with centering elements in RelativeLayout.
I want My StackLayout with 3 Labels in in to be centered horizontally and vertically.
For achieving this I'm trying to do something like this:
rl.Children.Add(
textLogo,
Constraint.RelativeToParent(parent => { return (parent.Width - textLogo.Width)/2; }),
Constraint.RelativeToParent(parent => { return (parent.Height- textLogo.Height)/2; })
);
// Where rl is RelativeLayout and textLogo is StaskLayout
But something is wrong. textLogo.Width is -1 for some reason when this code is invokes.
So is there a way to center my textLogo in RelativeLayout?