首页 > 解决方案 > xamarin 形式的不必要的条带

问题描述

在移动设备上编译时,会出现一个不在代码中的空行。在设计师的工作室里一切都很好,但在电话里一切都不同了。错误可能在哪里?

    <Grid.RowDefinitions>
        <RowDefinition Height="2*"/>
        <RowDefinition Height="3*"/>
        <RowDefinition Height="auto"/>
        <RowDefinition Height="10*"/>
        <RowDefinition Height="auto"/>
        <RowDefinition Height="4*"/>
    </Grid.RowDefinitions>

    <Grid Row="0" ColumnSpacing="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>
        <Grid Column="0">
            <SearchBar  x:Name="SearchNickname" 
                        BackgroundColor="{Binding BackColor}"
                        CancelButtonColor="{Binding TextColor}" 
                        PlaceholderColor="{Binding TextColor}"
                        TextColor="{Binding TextColor}"
                        HorizontalTextAlignment="Center"
                        VerticalTextAlignment="Center"
                        Placeholder="Введите свой ник"           
                        SearchCommand="{Binding SearchCmd}" 
                        Text="{Binding SearchText, Mode=TwoWay, UpdateSourceEventName=TextChanged}" 
                        MaxLength="100"/>
        </Grid>
        <Grid Column="1" BackgroundColor="{Binding BackColor}">
            <Button ImageSource="https://assets.laut.fm/f69a3423e545055c32430e0a77ebe148?t=_120x120" 
                    BackgroundColor="{Binding BackColor}"
                    Command="{Binding SettingsCmd}"/>
        </Grid>
    </Grid>

这条带子是哪里来的?在此处输入图像描述

设计师工作室中的图像 在此处输入图像描述

标签: xamlxamarinxamarin.forms

解决方案


顶部的那个条带是页眉/导航栏,默认情况下您可以在 Xamarin 表单页面中获得它。您可以修改或抑制它。


推荐阅读