增加网格大小

时间:2020-10-11 19:29:32

标签: xaml xamarin.forms

我正在设计一个登录屏幕,这是我的xaml

我不能增加红色背景的网格大小,因为我输入了很多“条目”,但是这些消失了,如果您知道任何属性,请给我您的建议

<?xml version="1.0" encoding="utf-8" ?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
     
<ContentPage.Content>
    <yummy:PancakeView
    BackgroundGradientStartPoint="0,1"
    BackgroundGradientEndPoint="1,0"
    Margin="0,0,0,10"        
    HorizontalOptions="FillAndExpand"      
    CornerRadius="0,0,400,0">
        <yummy:PancakeView.BackgroundGradientStops>
            <yummy:GradientStopCollection>
                <yummy:GradientStop Color="#155cab" Offset="0" />
                <yummy:GradientStop Color="#155cab" Offset="0.5" />
            </yummy:GradientStopCollection>
        </yummy:PancakeView.BackgroundGradientStops>
        <StackLayout>
            <yummy:PancakeView
            BackgroundGradientStartPoint="0,1"
            BackgroundGradientEndPoint="1,0"
            HeightRequest="240"
            WidthRequest="320"
            Padding="0,0,100,500"         
            HorizontalOptions="End"      
            CornerRadius="0,0,500,0">
                <yummy:PancakeView.BackgroundGradientStops>
                    <yummy:GradientStopCollection>
                        <yummy:GradientStop Color="#155cab" Offset="0" />
                        <yummy:GradientStop Color="#1C75D8" Offset="0.5" />
                        <yummy:GradientStop Color="#589ce7" Offset="1" />
                    </yummy:GradientStopCollection>
                </yummy:PancakeView.BackgroundGradientStops>
                <Grid BackgroundColor="red"  Margin="100,0,0,0" VerticalOptions="StartAndExpand">
                    <Grid.RowDefinitions>
                        <RowDefinition  Height="Auto"    />
                        <RowDefinition  Height="*"    />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Image                               
                            Grid.Row="0"
                            WidthRequest="100"
                            HeightRequest="100"
                            Source="UserLogin.png"
                            Margin="0,50,0,50"
                    />

                    <StackLayout Grid.Row="1" BackgroundColor="Orange">
                        <Entry Placeholder="hello"/>
                        <Entry  Placeholder="hello 1"/>
                        <Entry  Placeholder="hello 2"/>
                        <Entry  Placeholder="hello 3"/>
                        <Entry  Placeholder="hello 4"/>
                        
                    </StackLayout>
                </Grid>          
            </yummy:PancakeView>
        </StackLayout>
    </yummy:PancakeView>
</ContentPage.Content>

我要显示图像(XAML文件)。请帮助我

enter image description here

1 个答案:

答案 0 :(得分:0)

您在第二个yummy:PancakeView中将底部填充设置为500。我按照以下布局将其设置为0,就可以了。

<?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:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
             x:Class="PanCakeView.MainPage">

    <ContentPage.Content>
        <yummy:PancakeView
    BackgroundGradientStartPoint="0,1"
    BackgroundGradientEndPoint="1,0"
    Margin="0,0,0,10"        
    HorizontalOptions="FillAndExpand"      
            
    CornerRadius="0,0,400,0">
            <yummy:PancakeView.BackgroundGradientStops>
                <yummy:GradientStopCollection>
                    <yummy:GradientStop Color="#155cab" Offset="0" />
                    <yummy:GradientStop Color="#155cab" Offset="0.5" />
                </yummy:GradientStopCollection>
            </yummy:PancakeView.BackgroundGradientStops>
            <StackLayout>
                <yummy:PancakeView
            BackgroundGradientStartPoint="0,1"
            BackgroundGradientEndPoint="1,0"
            HeightRequest="800"
            WidthRequest="320"
            Padding="0,0,100,0"         
            HorizontalOptions="End"      
            CornerRadius="0,0,500,0">
                    <yummy:PancakeView.BackgroundGradientStops>
                        <yummy:GradientStopCollection>
                            <yummy:GradientStop Color="#155cab" Offset="0" />
                            <yummy:GradientStop Color="#1C75D8" Offset="0.5" />
                            <yummy:GradientStop Color="#589ce7" Offset="1" />
                        </yummy:GradientStopCollection>
                    </yummy:PancakeView.BackgroundGradientStops>


                    <Grid BackgroundColor="red"  Margin="100,0,0,0"  VerticalOptions="StartAndExpand">
                        <Grid.RowDefinitions>
                            <RowDefinition  Height="Auto"    />
                            <RowDefinition  Height="*"    />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Image                               
                            Grid.Row="0"
                            WidthRequest="100"
                            HeightRequest="100"
                            Source="UserLogin.png"
                            Margin="0,50,0,50"
                    />

                        <StackLayout Grid.Row="1" BackgroundColor="Orange">
                            <Entry Placeholder="hello"/>
                            <Entry  Placeholder="hello 1"/>
                            <Entry  Placeholder="hello 2"/>
                            <Entry  Placeholder="hello 3"/>
                            <Entry  Placeholder="hello 4"/>

                        </StackLayout>
                    </Grid>

                </yummy:PancakeView>
            </StackLayout>
        </yummy:PancakeView>
    </ContentPage.Content>

</ContentPage>

此处正在运行屏幕截图。

enter image description here

相关问题