【问题标题】:How to remove margin between nativescript buttons?如何删除 nativescript 按钮之间的边距?
【发布时间】:2020-04-21 14:22:22
【问题描述】:

嘿,我正在尝试使用 vue 在 nativescript 中创建自己的底部导航,但我无法让按钮填满整个空间。任何想法为什么它不起作用?我在 gridlayout 组件中有按钮,我将高度/宽度属性都设置为 100%,但按钮之间仍有一些空间。

<template>
  <GridLayout rows="*" columns="*,*,*" horizontalAlignment="stretch">
    <Button
      row="0"
      col="0"
      text="Potty Logger"
      :class="{ active: active == 0, '-primary': active != 0 }"
      @tap="goTo(0)"/>
    <Button
      row="0"
      col="1"
      :class="{ active: active == 1, '-primary': active != 1 }"
      :isEnabled="active != 1"
      text="Walk Tracker"
      @tap="goTo(1)"/>
    <Button
      row="0"
      col="2"
      :class="{ active: active == 2, '-primary': active != 2 }"
      text="History"
      @tap="goTo(2)"
  /></GridLayout>
</template>

<style lang="scss" scoped>
label {
  vertical-align: center;
  text-align: center;
}

button {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: none;
}
</style>

【问题讨论】:

    标签: nativescript nativescript-vue


    【解决方案1】:

    尝试设置

    button {
      border-width: 1;
      border-color: your-background-color;
    }
    

    【讨论】:

    • 啊,它有效!谢谢。我尝试将边框宽度设置为 0,但我没想过尝试更改边框颜色。
    • 实际上,它有点工作,但如果我将边框宽度设置为 1,我会丢失按钮点击动画。有什么想法吗?
    • 如果没有重现问题的样本,我不确定您的情况。
    猜你喜欢
    • 2016-07-24
    • 2019-12-17
    • 2021-11-17
    • 2023-03-31
    • 1970-01-01
    • 2023-03-09
    • 2020-02-09
    • 2019-06-13
    • 1970-01-01
    相关资源
    最近更新 更多