我想在文本上加下划线: Text with a styled underline
答案 0 :(得分:0)
Xamarin表单提供了TextDecorations属性。请尝试以下代码
<StackLayout
Padding="30"
BackgroundColor="#fafafa"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Label
FontSize="Large"
HorizontalOptions="FillAndExpand"
Text="The Steps"
TextDecorations="Underline" />
</StackLayout>
答案 1 :(得分:0)
您可以在框视图上方重叠标签以获得所需的结果。
<Grid>
<BoxView
HeightRequest="6"
HorizontalOptions="Start"
WidthRequest="{Binding Source={x:Reference label}, Path=Width}" Color="Gold" VerticalOptions="End"/>
<Label
x:Name="label"
FontSize="30"
HorizontalOptions="Start"
Text="The Steps">
</Label>
</Grid>
结果视图屏幕截图
但是,如果无法达到下划线处p
下冲程周围的空间。如果需要空格,请尝试使用SkiaSharp(图形库)。