c# - xamarin 中的网格样式

标签 c# css xamarin styles

我在 xamarin 表单中使用 css 样式。我有网格 wirh 按钮:enter image description here

StackLayout {
    background-color: #1e1e1e;
    color: #ffffff;
}

Button{
    background-color: #2d2d30;
    font-family: Consolas;
    font-size: 24;

    margin: 0;
}

和xaml:

<Grid>
    <Grid.ColumnDefinitions>
    /*...*/
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
    /*...*/
    </Grid.RowDefinitions>
    <Button/>
    <Button/>
    /*...*/
</Grid>

如何消除按钮之间的间隙?

最佳答案

这是行内 block 元素问题。如您所见:

button {
  width: 50px;
  height: 50px;
  background: #000;
  outline:none;
  border:none;
  margin:0;
}
<button></button>
<button></button>
<button></button>

我们可以使用这两种方法来消除间隙。

  1. 相邻写

button {
  width: 50px;
  height: 50px;
  background: #000;
  outline:none;
  border:none;
}
<button></button><button></button><button></button>

  1. 评论行

button {
  width: 50px;
  height: 50px;
  background: #000;
  outline:none;
  border:none;
}
<button></button><!--
--><button></button><!--
--><button></button>

关于c# - xamarin 中的网格样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58580256/

相关文章:

ios - native 链接失败, undefined symbol : _dispose_managed_object during deployment to an iOS device

android - 在 Xamarin 上使用来自 Android Studio 的 xml

xamarin 渲染器无效转换

c# - 在C#中获取java包的可用函数/方法

javascript - 点击按钮调用js代码

html - 顶部栏子菜单在移动 View 基础中不起作用

javascript - HTML/JQuery : Button Only Working Once

c# - 当理论上不可能到达分支时抛出什么异常?

C# 和 EF 无法将相关实体添加到模型

c# - 返回一个新值