Xamarin.forms Xamarin表单-网格上的IsClipedToBounds不起作用。孩子们的观点仍在剪辑中
我正在为一个应用程序构建一个简单的键盘,我想为按键使用浮动操作按钮。我把它们放在一个格子里,上面有一个标签,以获得下面的效果 如您所见,尽管IsClippedToBounds属性设置为false,栅格仍在剪裁阴影。我在网上到处搜索,没有找到多少关于这方面的信息。是虫子还是我做错了什么 下面是XAML布局Xamarin.forms Xamarin表单-网格上的IsClipedToBounds不起作用。孩子们的观点仍在剪辑中,xamarin.forms,grid,floating-action-button,clipping,Xamarin.forms,Grid,Floating Action Button,Clipping,我正在为一个应用程序构建一个简单的键盘,我想为按键使用浮动操作按钮。我把它们放在一个格子里,上面有一个标签,以获得下面的效果 如您所见,尽管IsClippedToBounds属性设置为false,栅格仍在剪裁阴影。我在网上到处搜索,没有找到多少关于这方面的信息。是虫子还是我做错了什么 下面是XAML布局 <?xml version="1.0" encoding="UTF-8"?> <ContentView xmlns="http://xamarin.com/schemas/2
<?xml version="1.0" encoding="UTF-8"?>
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:fab="clr-namespace:Refractored.FabControl;assembly=Refractored.FabControl"
x:Class="CauseMobileWalletMerchant.Views.KeypadView">
<ContentView.Content>
<Grid
BackgroundColor="Transparent"
Margin="0"
IsClippedToBounds="false"
HorizontalOptions="Center"
VerticalOptions="Center"
RowSpacing="0"
ColumnSpacing="0">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="75" />
<ColumnDefinition
Width="75" />
<ColumnDefinition
Width="75" />
<ColumnDefinition
Width="75" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition
Height="75" />
<RowDefinition
Height="75" />
<RowDefinition
Height="75" />
<RowDefinition
Height="75" />
</Grid.RowDefinitions>
<fab:FloatingActionButtonView
HorizontalOptions="Center"
VerticalOptions="Center"
Grid.Row="0"
Grid.Column="0"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="7"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="0"
Grid.Column="0"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="0"
Grid.Column="1"
Margin="0"
ColorNormal="{DynamicResource Primary}"
IsEnabled="true"
HasShadow="true"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="8"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="0"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="0"
Grid.Column="2"
Margin="0"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="9"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="0"
Grid.Column="2"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="0"
Grid.Column="3"
Margin="0"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="CLEAR"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="12"
Grid.Row="0"
Grid.Column="3"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="1"
Grid.Column="0"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="4"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="1"
Grid.Column="0"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="1"
Grid.Column="1"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="5"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="1"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="1"
Grid.Column="2"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="6"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="1"
Grid.Column="2"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="1"
Grid.Column="3"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="QR"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="12"
Grid.Row="1"
Grid.Column="3"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="2"
Grid.Column="0"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="1"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="2"
Grid.Column="0"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="2"
Grid.Column="1"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="2"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="2"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="2"
Grid.Column="2"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="3"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="2"
Grid.Column="2"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="2"
Grid.Column="3"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="FACE"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="12"
Grid.Row="2"
Grid.Column="3"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="3"
Grid.Column="0"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="0"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="3"
Grid.Column="0"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="3"
Grid.Column="1"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="00"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="3"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="3"
Grid.Column="2"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="-"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="22"
Grid.Row="3"
Grid.Column="2"
HorizontalOptions="Center"
VerticalOptions="Center" />
<fab:FloatingActionButtonView
Grid.Row="3"
Grid.Column="3"
ColorNormal="{DynamicResource Primary}"
ColorPressed="{DynamicResource PrimaryDark}"
ColorRipple="{DynamicResource PrimaryDark}" />
<Label
Text="TOTAL"
InputTransparent="true"
FontAttributes="Bold"
TextColor="White"
FontSize="12"
Grid.Row="3"
Grid.Column="3"
HorizontalOptions="Center"
VerticalOptions="Center" />
</Grid>
</ContentView.Content>
您正在网格画布内绘制阴影按钮。每个按钮都画在单元格画布内。很明显,通常不会在父画布之外绘制子画布 这个问题的解决方案,不用说通常的网格“创建自定义渲染器”,就是在以前的子对象上绘制每个子对象。然后阴影会像你想要的那样重叠。因此,您需要模拟单元格:创建一个网格作为容器,每个按钮都将位于单元格0,0中,但具有适当的边距x、y偏移,以避免与其他按钮重叠。在运行时创建偏移,在父级大小更改时更新它们,您将得到它