我有一个 Xamarin Forms 项目,我需要一个自定义按钮。该按钮看起来像这样:
![enter image description here](https://i.stack.imgur.com/v17GA.png)
我假设我需要创建一个自定义渲染器,但我不知道如何在按钮内有两种不同的字体大小?
我需要 Android 和 iOS 的渲染器。任何帮助将不胜感激。谢谢!
如何跳过自定义渲染器并使用Frame
使用包含格式化文本的点击手势Label
:
<Frame VerticalOptions="Center" HorizontalOptions="Center" CornerRadius="10" BackgroundColor="Gray" BorderColor="Black">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="OnFrameTapped"/>
</Frame.GestureRecognizers>
<Label>
<Label.FormattedText>
<FormattedString>
<Span Text="2" FontSize="30" />
<Span Text="ABC" FontSize="15" />
</FormattedString>
</Label.FormattedText>
</Label>
</Frame>
![enter image description here](https://i.stack.imgur.com/oambp.png)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)