代码之家  ›  专栏  ›  技术社区  ›  Mert Altiparmak

xamarin表单应用程序中登录页面的用户名和密码编辑文本之间不需要的空格

  •  0
  • Mert Altiparmak  · 技术社区  · 2 年前

    那是我的登录页面。“Kullan±c±kodu”表示用户代码,“ifre”表示密码。我不希望用户代码和密码编辑文本之间有这些空格。我使用了devexpress ComboboxEdit和TextEdit。我试图更改边距、填充、布局的填充、网格的高度、文本编辑高度请求。。。但没有变化。那些空间仍然存在!

    enter image description here

    XAML

    <ContentPage.Content>
        <StackLayout  
            VerticalOptions="Center" 
                HorizontalOptions="CenterAndExpand"
                      Margin="15" Padding="5">
            <Image Source="@drawable/ida_logo" />
            <Label x:Name="denemeText"
                   Text="Çözüm Ortağınız" 
                   FontSize="Title" 
                   TextColor="Black" 
                   FontFamily = "LobsterTwoItalic"   
                   xct:ShadowEffect.Color="SlateGray"   
                   xct:ShadowEffect.Opacity="0.8"
                   VerticalOptions="CenterAndExpand" 
                   HorizontalOptions="CenterAndExpand" />
            
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="60" />
                    <RowDefinition Height="80" />
                    <RowDefinition  Height="80"/>
                    
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    
                </Grid.ColumnDefinitions>
                
                <dxe:ComboBoxEdit  
                                
                                x:Name="databasePicker"
                                BackgroundColor="White"
                                LabelText="Veritabanı"
                                Grid.Row="0" Grid.Column="0" 
                                LabelColor="Black"  
                                TextFontSize="18"
                                LabelFontSize="18"
                                DropDownItemFontSize="18"
                                BottomTextFontSize="18"
                                AffixFontSize="18"
                                HorizontalOptions="FillAndExpand"
                                BorderColor="Black"
                                BorderThickness="1"
                                TextFontFamily="Roboto"
                                AffixFontFamily="Roboto"
                                BottomTextFontFamily="Roboto"
                                DropDownItemFontFamily="Roboto"
                                DropDownItemTextColor="Black"
                                DropDownSelectedItemTextColor="Black"                                 
                                TextHorizontalAlignment="Center"
                                VerticalOptions="FillAndExpand"
                                HeightRequest="60"
                                TextColor="Black"  />
    
    
    
                
                <dxe:TextEdit
                    x:Name="loginCustomEntryKullanici"
                     
                    
                     LabelText="Kullanıcı Kodu"
                     TextFontSize="18"
                     LabelFontSize="18"
                     BottomTextFontSize="18"
                     AffixFontSize="18"
                     LabelColor="Black"
                     BackgroundColor="White"
                     BorderColor="Black"
                     ReserveBottomTextLine="True"
                     AutofillContentType="None"
                     IsLabelFloating="True"
                     AffixFontFamily="Roboto"
                     BottomTextFontFamily="Roboto"
                     TextFontFamily="Roboto"
                     Grid.Row="1" Grid.Column="0"
                     HeightRequest="90"
                    VerticalOptions="FillAndExpand"
                
                />
                <dxe:PasswordEdit
                   x:Name="loginCustomEntryPass"
                    
                     LabelText="Şifre"
                     TextFontSize="18"
                     LabelFontSize="18"
                     BottomTextFontSize="18"
                     LabelColor="Black"
                     BackgroundColor="White"
                     BorderColor="Black"
                     ReserveBottomTextLine="True"
                     IsLabelFloating="True"
                     BottomTextFontFamily="Roboto"
                     TextFontFamily="Roboto"
                     Grid.Row="2" Grid.Column="0"
                     VerticalOptions="FillAndExpand"
                    HeightRequest="80"
                
                />
                     
    
            </Grid>
            <Button x:Name="giris_Button" 
                    Text="Giriş Yap" 
                    TextColor="Black"
                    FontSize="Medium"
                    Clicked="giris_Button_Clicked1" 
                    VerticalOptions="Center" 
                    BackgroundColor="Transparent" 
                    BorderColor="Black"  
                    BorderWidth="1"
                    CornerRadius="8"
                    xct:TouchEffect.AnimationDuration="250"
                    xct:TouchEffect.AnimationEasing="{x:Static Easing.CubicInOut}"
                    xct:TouchEffect.PressedScale="1.25"
                    xct:TouchEffect.PressedBackgroundColor="AliceBlue"
                    xct:TouchEffect.NormalBackgroundColor="Transparent"
                    />
            
            
    
    
        </StackLayout>
    </ContentPage.Content>
    
    0 回复  |  直到 2 年前
        1
  •  1
  •   Julian    2 年前

    您定义了不同的行高度,如果行内控件的高度与行高度不匹配,您将看到间隙。

    我几乎可以肯定,行高度和控件实际高度之间的差异是造成这种情况的原因。

    尝试从此更改行定义:

    <Grid.RowDefinitions>
        <RowDefinition Height="60" />
        <RowDefinition Height="80" />
        <RowDefinition Height="80"/>
    </Grid.RowDefinitions>
    

    对此:

    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    

    注: 通常,不建议使用 Auto 设置,但我相信这是问题的根源,所以你可能想尝试一下。

    您可能还需要更改或删除 HeightRequest 的设置 ComboBoxEdit , TextEdit 和 PasswordEdit 控件。

    或者,也可以为每一行指定相同的高度:

    <Grid.RowDefinitions>
        <RowDefinition Height="60" />
        <RowDefinition Height="60" />
        <RowDefinition Height="60" />
    </Grid.RowDefinitions>
    

    然后也要确保给你的控制权 HeightRequest="60" :

    <dxe:ComboBoxEdit
        HeightRequest="60" />
    
    <dxe:TextEdit
        HeightRequest="60" />
    
    <dxe:PasswordEdit
        HeightRequest="60" />
    
        2
  •  0
  •   Rıdvan Can Kıran    2 年前

    如果您尝试使用保证金进行设置,您可能会遇到不同分辨率的问题。自动行对齐将更加准确。