【HarmonyOS NEXT】获取控件宽高以及位置信息

39 阅读1分钟

获取控件的位置信息

    Column() {
      Button("Test")
        .onAreaChange((old,newV)=>{
          console.log("onAreaChange 宽",newV.width as number);
          console.log("onAreaChange 高",newV.height as number);
          console.log("onAreaChange x",newV.position.x);
          console.log("onAreaChange y",newV.position.y);

        })
    }
  }