Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Label wrapping in RelativeLayout

$
0
0

I'm having some trouble with word wrapping of a label that's placed in a RelativeLayout. It's added with a non-zero xConstraint and non-zero yConstraint and a widthConstraint (which is effectively equal to the layout width - xConstraint). A heightConstraint is NOT set because the text may or may not require wrapping.

In this case, it appears that the height is calculated by wrapping the text at some width prior to width constraint being applied. The end result is a label whose text is wrapped but the height is too short. It's the height that the label would be if the label was wider (and not wrapped). If I set the label's "WidthRequest" to a really small value, the final height is very large even though the text is only wrapped to 2 lines. Again, it appears to show that the final label's height is the height that the label was thinner (and wrapped onto more lines).

Hard problem to verbalize so I hope it came across.

(This applies to Forms on iOS. The Android simulators that I'm using are all wide enough to not require wrapping at all.)


Viewing all articles
Browse latest Browse all 58056

Trending Articles