xamarin形式:页面变得非常大,我不确定为什么

时间:2019-01-31 06:08:47

标签: xaml xamarin xamarin.forms

<ContentPage.Content>
    <ScrollView>
    <StackLayout HorizontalOptions="FillAndExpand" Padding="0">

        <Label FontSize="Large" Margin="6" HorizontalTextAlignment="Center" Text="Revisión Técnica" HorizontalOptions="Center"></Label>
        <BoxView HorizontalOptions="FillAndExpand" HeightRequest="3" Color="Black"></BoxView>

            <StackLayout IsVisible="True" Orientation="Horizontal" Padding="0" x:Name="ContainerSec" HorizontalOptions="FillAndExpand">
                <StackLayout Padding="0" Spacing="0">
                    <StackLayout BackgroundColor="LightGray" Padding="0">
                        <Label Margin="8" VerticalOptions="Center" VerticalTextAlignment="Center" Text="Lista de detalles"></Label>
                    </StackLayout>
                    <StackLayout Padding="0" Spacing="0" x:Name="VisualColumnWRP" WidthRequest="{Binding widthCol,Source={x:Reference Pagexaml}}" MinimumWidthRequest="{Binding widthCol,Source={x:Reference Pagexaml}}">

                    </StackLayout>
                </StackLayout>

                <BoxView WidthRequest="3" VerticalOptions="FillAndExpand" Color="{StaticResource type2-color}"></BoxView>

                <StackLayout Padding="0" Spacing="0" HorizontalOptions="FillAndExpand" VerticalOptions="Start">
                    <Grid x:Name="ElGrid" HorizontalOptions="FillAndExpand">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0"/>
                         <RowDefinition x:Name="row1" Height="Auto"></RowDefinition>
                        <RowDefinition x:Name="row2" Height="Auto"/>
                        <RowDefinition x:Name="row3" Height="Auto"></RowDefinition>
                        <RowDefinition x:Name="row4" Height="Auto"/>
                        <RowDefinition x:Name="row5" Height="Auto"></RowDefinition>
                        <RowDefinition x:Name="row6" Height="Auto"/>
                        <RowDefinition Height="0"/>

                        </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />

                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalOptions="End" Margin="5" Text="Garantía"></Label>
                    <Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="3" HorizontalOptions="Start" Margin="5" x:Name="Garantia"></Label>
                    <Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalOptions="End" Margin="5" Text="Descripción"></Label>
                    <Label Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="3" HorizontalOptions="Start" Margin="5" x:Name="Description"></Label>
                    <Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalOptions="End" Margin="5" Text="Detalle"></Label>
                    <Label Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="3" HorizontalOptions="Start" Margin="5" x:Name="Detail"></Label>

                    <StackLayout Orientation="Horizontal" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5">
                        <Label Margin="5" Text="Estado"></Label>
                        <suave:MaterialPicker x:Name="Picker" HorizontalOptions="FillAndExpand" Margin="5"></suave:MaterialPicker>
                    </StackLayout>

                    <StackLayout Orientation="Horizontal" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="5">
                        <Label Margin="5" Text="Nota"></Label>
                        <Editor x:Name="EditorWRP" HeightRequest="100" HorizontalOptions="FillAndExpand"></Editor>
                    </StackLayout>

                    <StackLayout Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="5">
                        <suave:MaterialButton Clicked="MaterialButton_Clicked"  BackgroundColor="LightGray" Text="Agregar evidencia" Margin="5"></suave:MaterialButton>
                    </StackLayout>

                </Grid>
            </StackLayout>


        </StackLayout>
            <Image x:Name="GalleryImage"></Image>
    </StackLayout>

    </ScrollView>
</ContentPage.Content>

上一个代码生成下一个屏幕,但是高度比平板电脑模拟器的高度大得多,我不知道为什么。

screen of the app 我解决它的唯一方法是声明具有固定高度的网格,但是即使窗口很大并且我检查了它的高度值,结果还是很小。谢谢您的帮助

1 个答案:

答案 0 :(得分:0)

您可以将滚动视图放入绝对布局并设置边界和标志-它应该可以工作