xamarin - 如何摆脱 Xamarin Forms 中网格行之间的空白行
问题描述
请注意此图像中第 0 行和第 1 行之间的空白(深蓝色)线...
我不确定这一行是从哪里来的,但是我该如何摆脱它,这样两行之间就没有间距了?
这是 XAML ......
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:control="clr-namespace:WP.MobileMidstream.Device.Pages"
x:Class="WP.MobileMidstream.Device.Pages.LoginPage"
Visual="Material">
<ContentPage.Resources>
<Style x:Key="HeaderStyle" TargetType="Grid">
<Setter Property="BackgroundColor" Value="#00458C" />
</Style>
</ContentPage.Resources>
<ContentPage.Content>
<Grid Style="{StaticResource HeaderStyle}"
Padding="0"
Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="23" />
<RowDefinition Height="56" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<BoxView Color="Red"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0" />
<Label Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"
BackgroundColor="RosyBrown"
Margin="0"
FontSize="20"
TextColor="White">Daily Run Sheet</Label>
<Image Source="hamburger_icon"
Margin="10, 0, 0, 0"
Grid.Row="1"
Grid.Column="0" />
</Grid>
</ContentPage.Content>
</ContentPage>
解决方案
我认为您对第二行的 ColSpan 和 Column 分配有误:
<Label Grid.Row="1"
Grid.Column="1"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"
BackgroundColor="RosyBrown"
Margin="0"
FontSize="20"
TextColor="White">Daily Run Sheet</Label>
<Image Source="hamburger_icon"
Margin="10, 0, 0, 0"
Grid.Row="1"
Grid.Column="0" />
更新: 尝试在网格上将 RowSpacing 设置为 0。
推荐阅读
- javascript - 使用 Google Analytics 推送卡片的 onclick 页面视图
- python - Python Pandas:如何使用 if 条件按行求和?
- c++ - 如何将数组中每个名称的首字母大写?
- sql - 是否可以在 PLSQL 中用局部变量值分配全局变量值
- addeventlistener - fancyapp 的 addEventListener 加载失败
- node.js - kubernetes:gpg 解密后,来自秘密 yaml 的值在节点 js 容器中被破坏
- html - 为什么我不能从我的 scss 文件中调用我的 id 变量?
- python - 熊猫:如何根据不同的单元格将熊猫中的值从数据帧复制到另一个数据帧
- oracle-sqldeveloper - 两个数据库顶部的集成/元数据层 - Oracle SQL Developer
- javascript - 登录 Firebase React Native Expo 后无法获取用户数据