I have two labels side by side in a horizontally oriented stack layout. The labels have different font sizes. I would like to make the baseline (bottom edge) of each label text the same regardless of the font size. However the default behaviour of xamarin forms is not to do that. The following code
<StackLayout Orientation="Horizontal" >
<Label FontSize="12" Text="A Noble Spirit"></Label>
<Label FontSize="18" Text="Embiggens The Smallest Man"></Label>
</StackLayout>
Results in the following view running on android.
I've tried many different combinations of setting the vertical text alignment and the vertical options attributes on the labels. The best I've been able to come up with (and what I think should work) is adding vertical options = end to them both. This improves things a bit but there's still a mismatch, so that the bigger label's text (embiggens) starts higher up than the smaller label - like so:
<StackLayout Orientation="Horizontal" >
<Label VerticalOptions="End" FontSize="12" Text="A Noble Spirit"></Label>
<Label VerticalOptions="End" FontSize="18" Text="Embiggens The Smallest Man"></Label>
</StackLayout>
As you can see, somewhat of an improvement, but still not aligned. This is driving me up the wall a bit. I'm starting to think it may be a bug in Xamarin Forms for android. (I'll add to this question later when I can get an example running on iOS to see if it's android specific.).
I CAN hack it to sort of work by adding top margin to the smaller label that is equal to the difference in font size, which is gross and I don't want to introduce that technical debt and upkeep into my system. But here it is to show it. Hoping not to have to resort to this...
<StackLayout Orientation="Horizontal" >
<Label FontSize="12" Margin="0,6,0,0" Text="A Noble Spirit"></Label>
<Label FontSize="18" Text="Embiggens The Smallest Man"></Label>
</StackLayout>