我是 XAML 的新手,在任何我读到它的地方,通常都会使用某种容器作为根视图(StackLayout、ContentPage、ContentView、RelativeLayout 等)。
但是,我遇到了这个使用 Image 作为根的 XAML。我们为什么要这样做?
<?xml version="1.0" encoding="utf-8" ?>
<Image
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:r="clr-namespace:My.Resources;assembly=My.Resources"
x:Class="My.Views.Buttons.MyView"
Source="MyImage.png"/>
我想用 FFImageLoading.CachedImage 替换这个 Image 但为此我需要添加 FFImageLoading xmlns 命名空间,但我不能,因为命名空间在 Image 标签内,而不是在外面。