Navigation容器中,子组件的高度为100%为什么没有撑满父容器?

为什么height(‘100%’)撑不满,下面留了一块,如果设置一个固定的很大的值是可以撑满的,那么height100%如何撑满呢?代码如下:

build() { 
  Navigation() { 
    Column() { 
    } 
    .size({ width: '100%', height: '100%' }) 
    .width('100%') 
    .height('100%') 
    .backgroundColor(Color.Black) 
  } 
  .size({ width: '100%', height: '100%' }) 
  .title('个性化设置') 
  .titleMode(NavigationTitleMode.Mini) 
  .backgroundColor(Color.Grey) 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.

Navigation容器中,子组件的高度为100%为什么没有撑满父容器?-鸿蒙开发者社区

窗口没有适配全屏模式。

HarmonyOS
2024-06-03 21:56:06
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zbw_apple

将窗口适配为全屏模式即可。代码如下:

import { window } from '@kit.ArkUI' 
 
@Entry 
@Component 
struct HeightTest { 
  onPageShow(): void { 
    window.getLastWindow(getContext(this), (err, win) => { 
      win.setWindowLayoutFullScreen(true) 
    }) 
  } 
  build() { 
    Navigation() { 
      Column() { 
      } 
      .width('100%') 
      .height('100%') 
      .backgroundColor(Color.Black) 
    } 
    .width('100%') 
    .height('100%') 
    .title('个性化设置') 
    .titleMode(NavigationTitleMode.Mini) 
    .backgroundColor(Color.Grey) 
  } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
分享
微博
QQ
微信
回复
2024-06-04 21:28:51
相关问题
HarmonyOS 容器如何撑满容器
1366浏览 • 1回复 待解决
组件溢出容器问题
2058浏览 • 1回复 待解决
HarmonyOS TextInput超出容器
426浏览 • 1回复 待解决
HarmonyOS 如何得到容器宽高尺寸
769浏览 • 1回复 待解决