HarmonyOS鸿蒙Next企业面试题之子组件收缩扩张属性(这里说的应该是flexShrink)

子组件收缩扩张属性

Row Column结合 layoutWeight实现弹性布局

Flex布局中使用flexShrink: 当父容器空间不足时,子组件的压缩比例。

Flex({ direction: FlexDirection.Row }) {
  Text('flexShrink(3)')
    .fontSize(15)
    .flexShrink(3)
    .width(200)
    .height(100)
    .backgroundColor(0xF5DEB3)

  Text('no flexShrink')
    .width(200)
    .height(100)
    .backgroundColor(0xD2B48C)

  Text('flexShrink(2)')
    .flexShrink(2)
    .width(200)
    .height(100)
    .backgroundColor(0xF5DEB3)
}.width(400).height(120).padding(10).backgroundColor(0xAFEEEE)

更多关于HarmonyOS鸿蒙Next企业面试题之子组件收缩扩张属性(这里说的应该是flexShrink)的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部