为什么 Xamarin.Forms.Shapes.Path 在旋转时被截断,就好像形状的边框没有随形状一起旋转一样?

Why is the Xamarin.Forms.Shapes.Path cut off when rotated, as if the shape's borders aren't rotated with the shape?

为什么 Xamarin.Forms.Shapes.Path 在旋转时被截断,好像形状的边框没有随形状一起旋转?我创建了 AbsoluteLayout,然后创建了几个形状并将它们添加到 AbsoluteLayout.Chidrens。当形状没有旋转时,一切都很好,当有旋转时,形状被裁剪成图像中的形状。

代码示例

AbsoluteLayout AL = new AbsoluteLayout();
RotateTransform RT = new RotateTransform { CenterX = SomeX, CenterY = SomeY, Angle = 20 };
EllipseGeometry CircleGeom = new EllipseGeometry { Center = new Point(SomeX, SomeY), RadiusX = 50, RadiusY = 50 };
Path CircleGeomPath = new Path { Data = CircleGeom, StrokeThickness = 1, Stroke = Color.Black, Fill = Color.White, RenderTransform = RT };
AbsoluteLayout.SetLayoutFlags(CircleGeomPath, AbsoluteLayoutFlags.None);
AL.Children.Add(CircleGeomPath);

RectangleGeometry RectGeom = new RectangleGeometry { Rect = new Rect { X = SomeX, Y = SomeY - 25, Width = 150, Height = 50 } };
Path RectPath = new Path { Data = RectGeom, StrokeThickness = 1, Stroke = Color.Black, Fill = Color.White, RenderTransform = RT };
AbsoluteLayout.SetLayoutFlags(RectPath, AbsoluteLayoutFlags.None);
AL.Children.Add(RectPath);

需要做什么才能使形状旋转而不被切断?

image example - shapes with and without rotation

我已经在我的设备上尝试过使用您的代码的不同布局和角度。最后,我认为这个问题是由系统将视图区域的大小设置为 Android 引起的。所以当view旋转的时候,一部分超出范围的时候会被截掉

所以你可以设置路径的heightrequest和weightrequest来给它一个更大的区域。如:

Path CircleGeomPath = new Path { Data = CircleGeom, StrokeThickness = 1, Stroke = Color.Black, Fill = Color.Blue, RenderTransform = RT,HeightRequest= 200,WidthRequest =400 };

Path RectPath = new Path { Data = RectGeom, StrokeThickness = 1, Stroke = Color.Black, Fill = Color.Blue, RenderTransform = RT, HeightRequest = 400, WidthRequest = 400 };