【发布时间】: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