代码之家  ›  专栏  ›  技术社区  ›  Swathy

如何给Xamarin形式的帧赋予阴影效果

  •  -1
  • Swathy  · 技术社区  · 7 年前

    我是新来的xamarin I wan,想在我的框架中添加阴影效果,并避免框架的顶部边界线,我尝试了框架的“hashadow”属性,但这对我没有帮助我怎么能这么做。

    请帮帮我

    这是我的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>
    

    代码给出这个输出

    enter image description here

    但我想要这样一页 enter image description here

    页数的差异用蓝色墨水标出。

    1 回复  |  直到 7 年前
        1
  •  3
  •   Ali123    7 年前

    亚历克斯·邓恩的这篇文章看起来正是你想要的: enter image description here https://alexdunn.org/2018/06/06/xamarin-tip-dynamic-elevation-frames/

    请注意,可以根据需要控制高程