xamarin.forms - 在 Xamarin.Forms 中使用 PathGeometry 剪切视图
问题描述
我正在尝试使用以下路径剪辑 StackLayout,但它不会在窗口中剪辑任何内容:GaugeView.xaml:
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.GaugeView.GaugeView">
<ContentView.Content>
<StackLayout
BackgroundColor="Red"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<StackLayout.Clip>
<PathGeometry
Figures="M0,150A300,300 0 1,1 300,150L220,150A300,300 0 1,1 80,150Z"/>
</StackLayout.Clip>
<Label
Text="Hello clip"/>
</StackLayout>
</ContentView.Content>
</ContentView>
MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.GaugeView.MainPage"
xmlns:local="clr-namespace:Xamarin.Forms.GaugeView">
<StackLayout>
<StackLayout>
<local:GaugeView
HorizontalOptions="Center"
WidthRequest="100"
HeightRequest="100"/>
</StackLayout>
</StackLayout>
</ContentPage>
我做错了什么?
解决方案
推荐阅读
- machine-learning - Deep Conv Model 参数个数
- angular - Typescript/Angular:静态类引用作为函数参数
- r - is.na() 或任何替代方法都不会获取 NA 值
- rest - 如何使用隔离的前端托管多服务解决方案
- sapui5 - 为什么不显示选择字段?
- reactjs - 反应 useState 与原始变量
- python-3.x - 如何从形状张量 (?,1152,8) 中可视化图像?
- java - 400 错误请求尝试 POST 到 Spring 端点
- python - 如何在循环中更新许多熊猫数据框
- angularjs - 选择地理网络主页中显示的类别