ios .net maui 的资源图像子文件夹问题

问题描述 投票:0回答:1

在 .net maui 的图像文件夹中具有子文件夹的源图像下方,我无法在 iOS 中获取图像。

<ImageButton Command="{Binding Path=GotoPreviousCommand}"
        Source="info_icons/next_left.svg"/>
<ImageButton Command="{Binding Path=GotoNextCommand}"
        Source="info_icons/next_right.svg"/>
xamarin xamarin.forms xamarin.ios maui
1个回答
0
投票

.NET MAUI 将 SVG 文件转换为 PNG 文件。因此,在将 SVG 文件添加到 .NET MAUI 应用程序项目时,应从 XAML 或 C# 中以 .png 扩展名引用它。

虽然你添加了子文件夹,但你可以通过这种方式引用图像(不需要添加子文件夹):

<ImageButton Command="{Binding Path=GotoPreviousCommand}"
    Source="next_left.svg"/>

更多信息可以参考加载本地图片

希望有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.