我是xamarin的新手,我想在框架中添加阴影效果并避免框架的顶部边框线,但是我尝试了框架的“ hasShadow”属性,但这无济于事。我该怎么办。
请帮助我
这是我的Xaml
<ListView x:Name="lv_search" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" RowHeight="105" ItemTapped="lv_search_ItemTapped"
SeparatorColor="White" BackgroundColor="Black" Margin="0,15,0,0">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="White">
<Grid Margin="20,10,0,10" BackgroundColor="White">
<Frame BackgroundColor="White" >
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" HorizontalOptions="StartAndExpand" VerticalOptions="FillAndExpand" Margin="0,0,10,0">
<AbsoluteLayout HorizontalOptions="StartAndExpand">
<Image Source="ellipse_1" VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand"
AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.01,0.4,1,1" BackgroundColor="White"/>
<Image Source="{Binding Image}" AbsoluteLayout.LayoutBounds="0.02,0.4,1,1" AbsoluteLayout.LayoutFlags="All"
HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" />
</AbsoluteLayout>
<StackLayout AbsoluteLayout.LayoutBounds="0.035,0.5,1,1" AbsoluteLayout.LayoutFlags="All" Orientation="Horizontal"
HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand">
<Label x:Name="lbl_categories" HorizontalOptions="StartAndExpand" VerticalOptions="CenterAndExpand"
Margin="10,0,0,0" FontFamily="Proxima-Nova-Semibold" TextColor="#222222" Text="{Binding Title}"
LineBreakMode="WordWrap" HorizontalTextAlignment="Start" FontSize="17.3" FontAttributes="Bold"/>
</StackLayout>
</StackLayout>
<Image HorizontalOptions="EndAndExpand" VerticalOptions="Center" Source="arrow"
AbsoluteLayout.LayoutBounds="0.9,0.3,0,0.3" AbsoluteLayout.LayoutFlags="All" />
</StackLayout>
</Frame>
</Grid>
<Image Source="img_frm" Margin="15,0,0,0" AbsoluteLayout.LayoutBounds="1,0.5,1,1" HorizontalOptions="StartAndExpand"
AbsoluteLayout.LayoutFlags="All"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
代码给出了此输出
页面差异用蓝色墨水标记。
答案 0 :(得分:2)
Alex Dunn撰写的这篇文章看起来完全像您想要的: https://alexdunn.org/2018/06/06/xamarin-tip-dynamic-elevation-frames/
请注意,您可以根据需要任意控制高程
答案 1 :(得分:1)
您可以在框架定义上使用 HasShadow="True"
属性。
你把 HasShadow
放在哪里了?应该是这样的
<i> <Frame HasShadow="True" ...> </Frame> </i>