渐变作为按钮边框颜色Xamarin Android?



我正在尝试在 Xamarin 窗体中创建具有渐变边框颜色的按钮,我在 IOS 中找到了以下解决方案,但我找不到适用于 android 的任何内容,有人可以帮助我吗?

渐变作为按钮边框颜色?

您可以使用PancakeView,它提供带有渐变的边框,并添加触摸手势识别器:

<yummy:PancakeView 
BackgroundColor="#e2e885" 
BorderGradientStops="{StaticResource Rainbow}" 
HeightRequest="150" 
CornerRadius="40,10,40,10" 
BorderThickness="4" 
BorderColor="#456287">
<yummy:PancakeView.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OnTapCommand}" NumberOfTapsRequired="1" />
</yummy:PancakeView.GestureRecognizers>
<Label Text="Button text" HorizontalOptions="Center" VerticalOptions="Center" />
</yummy:PancakeView>

最新更新