设置Grid子节点的相对高度

时间:2017-11-27 17:37:34

标签: xamarin xamarin.forms stacklayout

我将2个孩子添加到网格中,如下所示:

    private void pInitStackLayout()
    {
        grid1 = new Grid()
        {
        };

        grid2 = new Grid()
        {
        };

        biggrid = new Grid()
        {
            BackgroundColor = Color.Transparent,
            Margin = new Thickness(0),
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.StartAndExpand,
            Orientation = StackOrientation.Vertical,
        };
        biggrid.Children.Add(grid1,0,0);
        biggrid.Children.Add(grid2,0,1);

        this.Content = biggrid;
    }

ContentPage' s(导航页面)内容是biggrid。

我想这样做,以便grid1占用可用高度的80%,而grid2占用20%(或其余部分)。

我怎么能实现这个目标?

0 个答案:

没有答案