阅读:744回复:0
【鸿蒙】Navigation组件引入的页面,底部显示空白,页面不完整
在进行鸿蒙应用开发时,遇到下面的问题:
使用Navigation来显示引入的组件时,组件显示不完整,有部分是白色 代码如下: import ChartIndex from './Chart/chartIndex' import DetailIndex from './Detail/detailIndex' import RecordIndex from './Record/recordIndex' import { cloudFunction } from '@kit.CloudFoundationKit'; import { BusinessError } from '@kit.BasicServicesKit'; interface ToolBarItem{ title:string, icon:Resource , selIcon:Resource } @Entry @Component struct Index { @Builder NavigationToolBar(){ Row(){ ForEach(this.toolBarData,(v:ToolBarItem,i:number)=>{ Column(){ Image(this.selected==i?v.selIcon:v.icon).width(30) Text(v.title).fontColor(this.selected==i?$r('app.color.default_color'): $r('app.color.font_color')).fontSize($r('app.float.font_size1')) }.onClick(()=>{ this.selected = i }) }) }.height(66).width('100%').justifyContent(FlexAlign.SpaceAround) } @State selected:number = 0 @State toolBarData: ToolBarItem[] = [ {title:'明细',icon:$r('app.media.zhufang'),selIcon:$r('app.media.zhangbensel')}, {title:'记账',icon:$r('app.media.tianjia'),selIcon:$r('app.media.tianjiasel')}, {title:'图标',icon:$r('app.media.tubiao'),selIcon:$r('app.media.tubiaosel')}, ] build() { Navigation(){ if(this.selected==0){ DetailIndex() }else if(this.selected==1){ RecordIndex() }else{ ChartIndex() } }.toolbarConfiguration(this.NavigationToolBar()).hideTitleBar(false) } } 解决方案: 将.hideTitleBar属性设置为true, 代码:.hideTitleBar(true) hideTitleBar属性的含义:设置是否隐藏标题栏。 |
|
|