【问题标题】:Xamarin Forms Shapes inside SwipeView not working consistentlySwipeView 中的 Xamarin Forms Shapes 无法始终如一地工作
【发布时间】:2021-03-02 22:12:10
【问题描述】:

我从一个空白的 Xamarin Forms 模板创建了一个解决方案 (see code here),运行最新的稳定版 Xamarin Forms。我根据需要将实验性的 Shapes 和 SwipeView 添加到我的本地项目中,并且我有一个行列表,只是在 Collection View 中说“你好”。 我尝试在右侧滑动项的 Grid 中添加一个半圆形,因此该行看起来像一个圆形边缘而不是矩形。

但正如您在下图中看到的,形状在第二次向右滑动后就消失了。有时该形状甚至不会出现在该行的滑动项中。

请注意,标签始终显示,只是形状消失了。还在 Android 中进行了测试并注意到了相同的行为。您是否知道问题可能是什么以及是否有解决方法?

编辑:Posted this 并收到了对create an issue 的回复。仍在寻找解决方法

【问题讨论】:

    标签: xamarin xamarin.forms


    【解决方案1】:

    您可以使用FrameCornerRadius 来实现结果:

    <StackLayout Orientation="Horizontal" Padding="0" Margin="0" Spacing="0">
        <Label
            Text="Left"
            HorizontalOptions="CenterAndExpand"
            VerticalOptions="CenterAndExpand" />
        <!--<Path HorizontalOptions="EndAndExpand" Fill="White" Stroke="White" Aspect="Fill" Data="m0.19956,-0.20844l14.43749,0l0,0c7.97347,0 14.43748,6.51981 14.43748,14.56254c0,8.04265 -6.464,14.5625 -14.43748,14.5625l-14.43749,0l0,-29.12504z" >
        <Path.RenderTransform>
                <RotateTransform CenterX="14.637"
                                    CenterY="14.3541"
                                    Angle="180" />
            </Path.RenderTransform>
        </Path>-->
        <Frame BackgroundColor="Yellow" CornerRadius="30" IsClippedToBounds="True" HeightRequest="30" WidthRequest="30" HorizontalOptions="End" Margin="0,0,-51,0">
    
        </Frame>
    
    </StackLayout>
    

    【讨论】:

    • 天哪,我怎么没想到这个?
    • 我只需要在上游对父布局进行一些小调整,您的解决方案就奏效了!
    猜你喜欢
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-10
    • 2018-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多