HarmonyOS 使用position绝对定位+zIndex,还是会显示下面的文字?

// 当地货币提示
if (this.localTips) {
  Column(){
    Row({space: 10}){
      Image($r('app.media.ic_exchange_CN'))
        .width(30)
      Text('CNY')
      Image($r('app.media.ic_calc_setting_local'))
        .width(15)
    }
    .backgroundColor(Color.White)
    // .opacity(1)
    .width('100%')
    .padding(10)
    .borderRadius(5)
    Text('开启后,将会根据您的地理位置来显示所处国家/地区的货币')
      .fontColor(Color.White)
      .margin(15)
      .width('100%')
  }
  .backgroundColor('#2a3039')
  .borderRadius(10)
  // .opacity(1)
  .position({x: 0, y: 25})
  .width('75%')
  .padding(15)
  // .height(150)
  .zIndex(2)
}
阅读 465
1 个回答

按照以下方式修改试一下:

// 当地货币提示
if (this.localTips) {
  Column(){
    Row({space: 10}){
      Image($r('app.media.ic_exchange_CN'))
        .width(30)
      Text('CNY')
      Image($r('app.media.ic_calc_setting_local'))
        .width(15)
    }
    .backgroundColor(Color.White)
    // .opacity(1)
    .width('100%')
    .padding(10)
    .borderRadius(5)
    Text('开启后,将会根据您的地理位置来显示所处国家/地区的货币')
      .fontColor(Color.White)
      .margin(15)
      .width('100%')
  }
  .backgroundColor('#2a3039')
  .borderRadius(10)
  // .opacity(1)
  .position({x: 0, y: 25})
  .width('75%')
  .padding(15)
  // .height(150)
  // .zIndex(2)
}
}.width(Const.FULL_WIDTH).zIndex(2)
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进