【问题标题】:Xamarin.Forms Grid OverlappingXamarin.Forms 网格重叠
【发布时间】:2021-06-21 17:00:56
【问题描述】:

我想在条目中添加图标。我为此目的使用网格布局,图标在条目内,但它们与占位符重叠。可能是什么问题?提前致谢

       <Grid ColumnSpacing="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="35" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            
            <local:RoundedEntry x:Name="usernameEntry" Placeholder="Username" HorizontalOptions="FillAndExpand" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="5"/>
            <Image Source="{local:ImageResource DeliveryApplication.Logos.username.png}" Grid.Column="0" Grid.Row="1" Margin="10, 0, 0, 0"/>

            <local:RoundedEntry x:Name="passwordEntry" Placeholder="Password" IsPassword="True" HorizontalOptions="FillAndExpand" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="5"/>
            <Image Source="{local:ImageResource DeliveryApplication.Logos.password.png}" Grid.Column="0" Grid.Row="2" Margin="10, 0, 0, 0"/>
        </Grid>

【问题讨论】:

  • 如果您将两个元素放在同一个网格单元格中,它们将相互重叠。您的意思是将条目放在与图片不同的列中吗?
  • @Jason 你好,谢谢你的时间。我之所以使用这种方法,是因为我看到很多人在使用它。当我向条目添加左填充时效果很好

标签: c# xamarin xamarin.forms mobile grid


【解决方案1】:

由于该条目是自定义条目,因此我设法为其添加了填充,并且效果很好:)

【讨论】:

    猜你喜欢
    • 2018-08-29
    • 2023-03-31
    • 1970-01-01
    • 2020-05-19
    • 2017-09-30
    • 2019-02-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多