XamarinForms - 网格与嵌套 Stacklayouts - 性能最佳点

Pax*_*rce 7 performance xamarin xamarin.forms

考虑到性能- 网格和嵌套堆栈布局之间的最佳点在哪里?

StackLayout 有多少层“嵌套”才能使 Grid 的使用更加高效?

下面的示例(3 层 StackLayout 嵌套)是一种好的做法,还是应该使用 Grid 来代替?

<StackLayout>
    <StackLayout>
        <StackLayout>
            <Label>...text...</Label>
        </StackLayout>
        <StackLayout>
            <Label>...text...</Label>
        </StackLayout>
    </StackLayout>
    <StackLayout>
        <StackLayout>
            <Label>...text...</Label>
        </StackLayout>
        <StackLayout>
            <Label>...text...</Label>
        </StackLayout>
    </StackLayout>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)

Die*_*uza 10

你应该使用网格。我们在使用时常犯很多错误Xamarin.Forms。幸运的是,我发现这篇文章和视频对我帮助很大。其中一点正是针对您的问题的建议:

不要尝试通过使用其他布局的组合来重现特定布局的外观

Gridx 嵌套就是一个例子StackLayouts

我希望它也对你有帮助。