Xamarin 表单中的渐变按钮

Mai*_*ury 4 gradient xamarin xamarin.forms

渐变按钮

如何使用 Renderer 在 Xamarin Forms 中使用渐变效果创建此按钮?

Tha*_*eem 8

现在,Xamarin Forms 4.8 可以使用渐变画笔和拖放功能等新功能。

查看此链接 => https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/brushes/

您可以为任何元素(例如按钮、框架、框视图等)添加渐变背景。

按钮的示例代码:

<Button Text="Submit Order" CornerRadius="5" TextColor="White">
    <Button.Background>
        <LinearGradientBrush EndPoint="1,0">
            <GradientStop Color="Yellow" Offset="0.1" />
            <GradientStop Color="Green" Offset="1.0" />
        </LinearGradientBrush>
    </Button.Background>
</Button>
Run Code Online (Sandbox Code Playgroud)

输出:

在此处输入图片说明