xaml - 为什么在这种情况下看不到嵌套的 FlexLayout?

标签 xaml xamarin layout xamarin.forms

代码:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:FlexLayout2"
             x:Class="FlexLayout2.MainPage">

    <FlexLayout
        Direction="Column"
        JustifyContent="Start"
        AlignItems="Stretch">
        <FlexLayout
            Direction="Row"
            JustifyContent="Start"
            AlignItems="Stretch">
            <BoxView Color="Red"/>
            <BoxView Color="Black"/>
        </FlexLayout>

        <BoxView Color="Yellow"/>

    </FlexLayout>

</ContentPage>

我得到了什么:
Image

我的期望:
Image

问题说明了一切。
我缺少什么?

Xamarin 表单 3.2

最佳答案

如果你把你的 child flex 布局放在 <ContentView> 里面它会起作用:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:FlexLayout2"
             x:Class="FlexLayout2.MainPage">

    <FlexLayout
        Direction="Column"
        JustifyContent="Start"
        AlignItems="Stretch">
        <ContentView>
            <FlexLayout
                Direction="Row"
                JustifyContent="Start"
                AlignItems="Stretch">
                <BoxView Color="Red"/>
                <BoxView Color="Black"/>
            </FlexLayout>
        </ContentView>
        <BoxView Color="Yellow"/>
    </FlexLayout>
</ContentPage>

关于xaml - 为什么在这种情况下看不到嵌套的 FlexLayout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52486382/

相关文章:

c# - 如何将文件从独立存储复制到“下载”文件夹?

xamarin - "android.runtime.JavaProxyThrowable"是什么意思?我该如何解决?

android - 超链接显示在错误的地方

android - 布局何时完成加载

html - 博主布局问题

xaml - Xamarin 表单标签 - 合理吗?

c# - 无法将 WP 8.1 应用程序部署到移动设备

c# - MultiBinding 转换返回函数

c# - 在 WPF 中更改 ResizeGrip 的颜色

c# - 如何在 xamarin ios 的 ScrollView 中添加滚动条?