代码之家  ›  专栏  ›  技术社区  ›  Eugene van der Merwe

如果GridPrice与两个项目水平对齐,则避免与GridPrice重叠

  •  0
  • Eugene van der Merwe  · 技术社区  · 5 年前

    here 使两个水平对齐的项目左右居中。问题是现在我有项目名称文本太长,这意味着它与项目价格重叠。

    这一点很容易用这个图表来证明:

    enter image description here

    实际代码是:

    <ListView for="product in products" @itemTap="onItemTap">
      <v-template>
        <GridLayout rows="auto" columns="*">
          <Label row="0" horizontalAlignment="left" :text="product.title" />
          <Label row="0" horizontalAlignment="right" :text="'$'+product.price" />
        </GridLayout>
      </v-template>
    </ListView>
    

    GridLayout 该怎么办,还是有更好的办法?

    0 回复  |  直到 5 年前
        1
  •  2
  •   Tyler Blake    5 年前

    <GridLayout rows="auto" columns="*,auto">
            <Label col="0" row="0" textWrap="true" horizontalAlignment="left" [text]="item.title"></Label>
            <Label col="1" row="0" horizontalAlignment="right" [text]="'$'+item.price"></Label>
        </GridLayout>
    

    使用 columns="*,auto" textWrap="true 标题。

    如果你 GridLayout Label rowSpan="2"

    希望这有帮助!

    推荐文章