xml - 如何在 XML 中叠加两个图像?
问题描述
我想插入一个八角形的图像。所以我想将八角形(具有透明背景)叠加到图像上。这怎么可能?
我有一个简单网格中的图像,但我不知道如何在其上叠加八角形
我有这个 xml 代码:
<Grid ColumnSpacing="0" RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="AUTO"/>
<RowDefinition Height="AUTO"/>
<RowDefinition Height="AUTO"/>
<RowDefinition Height="*"/>
<RowDefinition Height="AUTO"/>
</Grid.RowDefinitions>
<Image Aspect="AspectFill" Source="LogoConRegalo.png"/>
<Image x:Name="ProfilePicture" HeightRequest="100" HorizontalOptions="Center" Source="Profile.png" TranslationY="50" VerticalOptions="End"/>
解决方案
你想达到如下截图的结果吗?
这是您的布局中的两个图像。
锋利的.jpg
图像.jpg
这是代码
<StackLayout>
<Grid ColumnSpacing="0" RowSpacing="0">
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Padding="0">
<Image Aspect="AspectFit" Source="sharp.jpg" HorizontalOptions="Center" VerticalOptions="Center" />
</StackLayout>
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Padding="10">
<Image HorizontalOptions="Center" VerticalOptions="Center" Source="image.jpg" Aspect="AspectFit" />
</StackLayout>
</Grid>
</StackLayout>
推荐阅读
- javascript - 模拟 window.performance.getEntriesByType
- sass - 如何从 Vite 中的 node_modules 加载 scss 变量和字体文件
- docker - Gitlab runner - 使用 ECR 注册表作为注册表镜像来减少对 dockerhub 的调用
- go - Go 中的验证器认为正确的请求正文是无效的
- swiftui - 诊断“线程 1:EXC_BREAKPOINT (code=1, subcode=0x195eff214)”错误
- arrays - Kotlin 是否支持像 Rust 和 Swift 这样的引用字符串/数组切片?
- android - 将数据保存在应用程序中,以便稍后在 android studio 中显示
- qemu - QEMU guest如何将数据包发送到主机的NIC?
- plugins - 无法启用 rabbitmq rabbitmq_auth_backend_oauth2 插件
- typescript - 使用 toggleDrawer 导航时出错。ToggleDrawer 不是函数