How can I vertical center text in a surrounding element? And/or let the char take up the complete height of the label, without 'ascent' and 'descent'? Aka let Label render the char without 'ascent' and 'descent'.
The primitive attempt does not work. The char is too low.
Code:
<Grid WidthRequest="100" HeightRequest="100"
BackgroundColor="HotPink">
<Ellipse Fill="#1A1A1A"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
<Label x:Name="numberElm"
FontSize="80"
FontAttributes="Bold"
Text="3"
VerticalOptions="Center"
HorizontalOptions="Center"
TextColor="White"
BackgroundColor="Transparent"
/>
</Grid>
Ideally there would be an option to render the number without the extra vertical space. I didn't find any api or property for that.
The quick and dirty solution i've found is a negative margin like 0,-10,0,0
.
It's kinda similar to this question for wpf: TextBlock as big as a capital letter (ignoring font ascender/descender)