【问题标题】:Add shadow to a Label - Xamarin.Forms向标签添加阴影 - Xamarin.Forms
【发布时间】:2017-11-28 04:02:41
【问题描述】:

我想为标签添加阴影。此标签在 Page 中重叠,就像打开过滤页面的始终可见的控件一样。

请在我的屏幕上找到一个 gif:

这是我的 XAML:

<!-- **** Filter button **** -->
<Label
    Margin="0,0,10,10"
    WidthRequest="50"
    HeightRequest="50"
    HorizontalOptions="End"
    VerticalOptions="End"
    HorizontalTextAlignment="Center"
    VerticalTextAlignment="Center"
    FontSize="30"   
    Style="{DynamicResource FilterAction}"
    Text="&#xf0b0;"
    BackgroundColor="{StaticResource ComplementColor}"
    FontFamily="{x:Static artina:FontAwesome.FontName}"
    TextColor="White">
    <Label.GestureRecognizers>
        <TapGestureRecognizer Command="{Binding btn_open_filter_businesses_click}" />
    </Label.GestureRecognizers>
</Label>

<templates:Badge 

    BadgeText="{Binding number_of_filters_selected}" 
    BadgeTextColor="White"  
    BadgeBackgroundColor="#1DBDFF"
    HorizontalOptions="End"
    VerticalOptions="End"
    TranslationX="-4"
    TranslationY="-4"
    IsVisible="{Binding number_of_filters_selected, Converter={StaticResource filterVis}"
    x:Name="filtersCountBagde">
    <templates:Badge.GestureRecognizers>
        <TapGestureRecognizer Command="{Binding btn_open_filter_businesses_click}" />
    </templates:Badge.GestureRecognizers>
</templates:Badge>

我想要 Gmail 之类的东西,请查找以下示例:

任何帮助将不胜感激。

【问题讨论】:

    标签: xaml xamarin.forms


    【解决方案1】:

    您可以使用 Xamarin 效果在您的按钮上实现阴影。您可以在此处下载一个代码示例,它应该可以帮助您入门:

    Shadow Effect

    这将涉及为您的影子创建特定于平台的实现。

    你也可以试试the idea put forward in this similar question

    【讨论】:

      猜你喜欢
      • 2011-07-07
      • 1970-01-01
      • 2012-02-19
      • 2015-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多